c# - How to dynamically assign lambda<expression> to expression -


I am trying to create dynamic expressions and assign lambda to it. As a result, I got an exception: System.Agentment exception: 'Test.ItsTrue' expression type 'System.Linq.Expressions.Expression`1 [Test.ItsTrue]'

to use for assignment Can not be done. what is wrong? Public Representative Bull's Trade (); Public category sample {public expression & lt; Its true & gt; Get it {true} Set; }} [Test class] public class mystage {[testimation] public zero testprotectorshipwith expression of delegate () {expression & lt; Its true & gt; ItsTrue = () = & gt; truth; // This time works on compiling new samples (). ItsTrue = itsTrue; // This ad runtime var new_ = Expression.New (typeof (sample)) does not work; Var result = expression. Assin (expression. Property (new_, typef (specimen) .getProperties () [0]), its true); }}

Expression. Assigning the second argument of For the value represented by expression you are currently trying effectively to assign the property to its transit you need to wrap it so that the value ItsTrue ... is an expression returning via either Expression.Quote or Expression.Constant . For example:

  var result = expression.assign (expression.property (new_, typef (sampling) .getproperties () [0]), expression. Constant (its true, typef (expression) & Lt; itsTrue & gt;));   

Alternatively, you want probably wanting expression. Question - It really depends on what you are trying to achieve.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -