c# - select all fields from ilist, contains list of objects -
i have ilist--->
ilist<test> list; the list contains objects of class test, given below:
list.add(new test{ id = 1, name = "abc" }) list.add(new test{ id = 2, name = "xyz" }) list.add(new test{ id = 3, name = "nmo" }) where class test --->
class test { int id; string name; } now want select name fields (of elements of list)--->
ilist<string> namelist = ??? i got stuck in (lack of knowledge linq c#)
ilist<string> namelist = yourcollection.select(item=> item.name).tolist();
Comments
Post a Comment