c# - Linq Expression Selector -


expression<func<t, object>> selector selector have parameter.

my method generic type , lets want multpile property values form class being called.

a =>a.customername being passed expression.please explain, possible have multiple selections ?

like example want customer address also, both string values.

if want multiple properties out, could use multiple parameters, each extracted single value, more common use lambda expression creates anonymous type. example:

var result = foo.somemethod(customer => new { customer.name, customer.address }); 

the compiler generate type name , address properties, , create expression tree creates instance of type using properties in customer object provided.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -