c# - create a list Using combination of two types -


i need create list in each member combination of 2 types , b. possible? example, assuming , b:

class {     int a1;     string a2; }  class b {     int b1;     string b2; } 

i want create:

list<a&b> samplelist; 

in way a&b contains following properties:

    int a1;     string a2;     int b1;     string b2; 

try tuples: https://msdn.microsoft.com/en-us/library/dd268536(v=vs.110).aspx

then can use:

var list = new list<tuple<int, string>>(); list.add(new tuple(2, "some text)); 

and read values like:

console.writeline(list[0].item1); // writes 2 console.writeline(list[0].item2); // writes "some text" 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -