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
Post a Comment