Is it possible to encode an assignment into an expression tree?
相关问题
- Check if tie in count of lists using linq
- Trouble with OR in Sharepoint CAML
- get key value pairs from xml using linq
- query and create objects with a one to many relati
- select column from dataset using LINQ
相关文章
- 想问问Linq中有没有根据条件选择要不要关联表。
- Why do I need a ToList() to avoid disposed context
- LINQ .Include() properties from sub-types in TPH i
- Can a method chain be called LINQ?
- Get grouped comma separated values with linq
- How does a LINQ expression know that Where() comes
-
Creating dynamic Expression
> - Entity Framework - An item with the same key has a
As Jon Skeet and TraumaPony have already said,
Expression.Assign
isn't available before .NET 4. Here's another concrete example of how to work around this missing bit:Then simply call
AssignmentExpression.Create()
in place ofExpression.Assign()
.You could probably work around it by nexting expression trees. Call a lambda function, where an argument is the value of the assignee.
No, I don't believe so.
Certainly the C# compiler disallows it when converting a lambda expression:
This yields the error:
You should able to do it with .NET 4.0 Library. by import Microsoft.Scripting.Core.dll to your .NET 3.5 project.
I am using DLR 0.9 - There might be some change on Expession.Block and Expression.Scope in version 1.0 (You can see reference from http://www.codeplex.com/dlr/Thread/View.aspx?ThreadId=43234)
Following sample is to show you.
My extension method for doing exactly this: