Software Development Network>> Visual C#>> find item at index using list <T>
>> I tried list<int>.items[4] but that won't compile even though the item property exists in documentation.
Well, it would be list<int>.Item(4) but that still doesn't work, as it's the indexer for the class. Use [ ] on the list object itself.
find item at index using list <T>
DaveStacy
List<int> l=new List<int>();
l.Add(1);
l.Add(2);
l.Add(3);
l.Add(4);
l.Add(5);
MessageBox.Show(l[2].ToString());
Rafael31
>> I tried list<int>.items[4] but that won't compile even though the item property exists in documentation.
Well, it would be list<int>.Item(4) but that still doesn't work, as it's the indexer for the class. Use [ ] on the list object itself.