Top "Expression-trees" questions

Expression Trees are an abstract representation of code in a tree structure where each node of the tree represents a programming construct (conditional, assignment, method call, etc.

Get the parameter value from a Linq Expression

I have the following class public class MyClass { public bool Delete(Product product) { // some code. } } Now I have a helper …

c# linq expression-trees
Generate EF orderby expression by string

I want to generate expression by string parameter,some code like: private Expression<Func<Task, T>> …

c# linq entity-framework expression-trees
How do I create an expression tree calling IEnumerable<TSource>.Any(...)?

I am trying to create an expression tree that represents the following: myObject.childObjectCollection.Any(i => i.Name == "name"); …

c# .net linq expression-trees
C# How to convert an Expression<Func<SomeType>> to an Expression<Func<OtherType>>

I have used C# expressions before based on lamdas, but I have no experience composing them by hand. Given an …

c# linq-to-sql lambda repository-pattern expression-trees
Building a LINQ expression tree: how to get variable in scope

I'm building a LINQ expression tree but it won't compile because allegedly the local variable $var1 is out of scope: …

c# .net linq lambda expression-trees
Replace parameter in lambda expression

Considering this code: public class Foo { public int a { get; set; } public int b { get; set; } } private void Test() { List&…

c# lambda expression-trees partial-application
C# LINQ to SQL: Refactoring this Generic GetByID method

I wrote the following method. public T GetByID(int id) { var dbcontext = DB; var table = dbcontext.GetTable<T>(); …

c# linq-to-sql generics expression-trees
Is there a way to create a delegate to get and set values for a FieldInfo?

For properties there are GetGetMethod and GetSetMethod so that I can do: Getter = (Func<S, T>)Delegate.CreateDelegate(…

c# delegates expression-trees setvalue fieldinfo
How do I specify the object to return from an expression tree method?

I'm trying to create a method using an expression tree that returns an object, but I can't figure out how …

.net expression-trees
What does Expression.Quote() do that Expression.Constant() can’t already do?

Note: I am aware of the earlier question “What is the purpose of LINQ's Expression.Quote method?”, but if you …

c# expression-trees