java - Getting an object variable from List in C# -


i have class variables:

public class items {     public string name;     public string id; } 

and have second class when have list of object of first class

public class myclass {     public items cheese;     public list <items> listofitems = new list ();     listofitems.add (cheese); // know should in method or it's example } 

and want name of cheese, using list, because have above 20 items in list. in java can like:

listofitems.get(1).name; // 1 index 

how can in c#? // please don't try improve my

listofitems[0].name; 

just remember start counting @ 0 ;)

other works same way java, different syntax


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

php - Improving script execution time -

How to provide Authorization & Authentication using Asp.net, C#? -