.net - LINQ sample: select typed objects from a list -



.net - LINQ sample: select typed objects from a list -

i have

dim objectslist list(of object) = getallobjects() ' filter objects persons ' dim peoplelist list(of person) = ???

what efficient , effective linq look it?

edit

1 dim selectedobjects list(of object) = getallobjects() 2 dim selectedpeople ienumerable(of person)= selectedobjects.oftype(of person) 3 dim people list(of person) = selectedpeople.tolist()

error on 3:

value of type 'system.collections.generic.list(of system.collections.generic.ienumerable(of person))' cannot converted 'system.collections.generic.list(of person)'.

sounds want enumerable.oftype():

dim peoplelist list(of person) = objectslist.oftype(of person)().tolist()

.net vb.net linq

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -