c# - Lambda Binding Expression for Array -
i working on writing dynamic select clause using lambda expressions , stuck @ point have deal nested collections. illustration
class { public string property1 {get;set;} public string property2 {get;set;} public ienumerable<b> property3 {get;set;} } class b { public string prop1 {get;set;} public int prop2 {get;set;} }
i have class , b shown above , collection of info within going binded grid, properties not required. view dependent. view defines fields display. hence creating object on fly , adds required properties it. have done using lambda look shown below,
expression.bind(p, expression.propertyorfield(entityexpression, p.name))
this works if have select property1 , property2 class a, if want property3 collection, not work creating type on fly , adding required properties it. hence @ run time have scenario like
ienumerable<runtimetype2> => runtimetype2 { string prop1 {get;set; } ienumberable<runtimetype1> => runtimetype1 { string property1 {get;set; ienumerable<runtimetype2> property3 {get;set;} }
above scenario want achieve. simple case able struggling bind collection.
i hope problem has plenty description. if need more info please reply. pointers helpful.
the problem seek force value of type ienumerable<b>
property type ienumerable<runtimetype2>
. have convert between 2 using nested select (that have create using look api phone call enumerable.select
method).
c# linq lambda expression-trees
No comments:
Post a Comment