tagged [expression]

Execute LambdaExpression and get returned value as object

Execute LambdaExpression and get returned value as object Is there a clean way to do this? This should work for different types.

31 Jul at 21:56

Expression<TDelegate>.Compile and Garbage Collection

Expression.Compile and Garbage Collection When I compile an expression into executable code and get the delegate - does the code get garbage collected when no more references to this delegate exist? I...

Expression Blend 3, solution not supported

Expression Blend 3, solution not supported I'm trying to open a silverlight 4 application solution in Expression Blend 3. However, Blend says that the solution is not supported. Is there something I'm...

How do I set a field value in an C# Expression tree?

How do I set a field value in an C# Expression tree? Given: How do I compile a lambda expression to set the field on the "target" parameter to "value"?

7 Feb at 14:15

Is this the proper way to do boolean test in SQL?

Is this the proper way to do boolean test in SQL? Assume active is a "boolean field" (tiny int, with 0 or 1) In words, can the "NOT" operator be applied directly on the boolean field?

11 Mar at 21:4

Expression trees for dummies?

Expression trees for dummies? I am the dummy in this scenario. I've tried to read on Google what these are but I just don't get it. Can someone give me a simple explanation of what they are and why th...

8 Mar at 21:21

c# convert string expression to a boolean expression

c# convert string expression to a boolean expression Is it possible to convert a string expression into a boolean condition? For example, I get the following string: I would like to create a `bool` ex...

17 Feb at 13:44

In C#, Is Expression API better than Reflection

In C#, Is Expression API better than Reflection Nowadays, I'm exploring C# Expression APIs. So I could use some help understanding how it works, including the difference between Expression and Reflect...

26 Jan at 10:5

Combine return and switch

Combine return and switch How can I combine `return` and `switch case` statements? I want something like I know about this solution ``` switch(a) { case 1: return "lalala"; case 2: return "blalbla...

What are Expression Trees, how do you use them, and why would you use them?

What are Expression Trees, how do you use them, and why would you use them? I just came across the concept of expression trees which I have heard multiple times. I just want to understand what is mean...

21 Jul at 19:5

What are some instances in which expression trees are useful?

What are some instances in which expression trees are useful? I completely understand the concept of expression trees, but I am having a hard time trying to find situations in which they are useful. I...

4 Dec at 08:41

Combining two expressions (Expression<Func<T, bool>>)

Combining two expressions (Expression>) I have two expressions of type `Expression>` and I want to take to OR, AND or NOT of these and get a new expression of the same type

27 Jun at 01:4

does visual studio express 2013 come with blend, how can i open it?

does visual studio express 2013 come with blend, how can i open it? I have been looking a for a while today and i didn't find anything about it, there is a lot about blend for visual studio 2013, but ...

How do the MVC html helpers use expressions to get an objects property

How do the MVC html helpers use expressions to get an objects property For example: If I were to get an expression like this as a method argument, how would I get the referenced property from the expr...

Spring cron expression for every after 30 minutes

Spring cron expression for every after 30 minutes I have following Spring job to run after every 30 minutes. Please check my cron expression, is that correct? Here is a full cron job definition from t...

4 Jun at 12:50

C# negate an expression

C# negate an expression I'm seeking for a way to negate an expression used to filter `IQueryable` sequences. So, I've got something like: Now I wish to create the expression which would result in yiel...

11 Dec at 16:30

How to add a Blend Behavior in a Style Setter

How to add a Blend Behavior in a Style Setter I have crated a Blend behavior for Button. How can I set that to all of my Buttons in the app. However, when I try: ```

26 Nov at 08:5

What's the purpose of the Expression class?

What's the purpose of the Expression class? I'm wondering what exactly is the difference between wrapping a delegate inside `Expression` and not ? I'm seeing `Expression` being used a lot with LinQ, b...

5 Jan at 21:57

How do Linq Expressions determine equality?

How do Linq Expressions determine equality? I am considering using a Linq Expression as a key in a dictionary. However, I am concerned that I will get strange results, because I don't know how Equalit...

How is a Func<T> implicitly converted to Expression<Func<T>>?

How is a Func implicitly converted to Expression>? I don't understand what is happening here: Both of these lines compile: But this doesn't: There isn't an implicit operator on `LambdaExpression` or `...

Create Expression from PropertyInfo

Create Expression from PropertyInfo I'm using an API that expects an `Expression>`, and uses this to create mappings between different objects: How can I create the necessary expression from a `Proper...

10 Oct at 06:51

C# Dynamic Method - IL vs Expression Trees

C# Dynamic Method - IL vs Expression Trees I'm playing and learning little with ANTLR building a simple DSL for .NET, transforming the script in string into Dynamic Method. My first idea was translate...

1 Feb at 00:39

How can I combine two lambda expressions without using Invoke method?

How can I combine two lambda expressions without using Invoke method? I have two lambda expressions: and the i type, comes from my poco entities, that can't used with invoke. I want to combine these i...

25 Jun at 11:5

Why is Func<> created from Expression<Func<>> slower than Func<> declared directly?

Why is Func created from Expression> slower than Func declared directly? Why is a `Func` created from an `Expression>` via .Compile() considerably slower than just using a `Func` declared directly ? I...

Can I generate an async method dynamically using System.Linq.Expressions?

Can I generate an async method dynamically using System.Linq.Expressions? I know the compiler can't convert an async lambda expression to an expression tree, but is it possible to generate the express...