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

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -