I use Expression Trees and want to get maximum performance from it. The common code is
ConstantExpression const1 = Expression.Constant(1);
ConstantExpression const2 = Expression.Constant(2);
BinaryExpression equality = Expression.Equal(const1, const2);
Expression ifTrue = Expression.Constant("I throw some exception here");
ConditionalExpression result = Expression.IfThen(equality, ifTrue);
The result.DebugView is .If (1 == 2) { "I throw some exception here" } .Else { .Default(System.Void) }
Is that possible to avoid
.Else { .Default(System.Void) }?
I mentioned this issue too late, and changes Expression.IfThen to Expression.IfThenElse require too many refactoring.
Compiler can make some code improvements in the release mode. Does it relate to expression trees too?
Aucun commentaire:
Enregistrer un commentaire