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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

ruby - Nesting modules inside of a Rails eninge gem -

Eclipse formatter for java ending braces -