.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

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -