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

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

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -