zzz projects Expression Tree Tutorial
Getting Started Documentation Knowledge Base
  • Getting Started
  • Documentation
  • Knowledge Base

Expression Tree Tutorial - Knowledge Base (KB)

English (en) Français (fr) Español (es) Italiano (it) Deutsch (de) русский (ru) 한국어 (ko) 日本語 (ja) 中文简体 (zh-CN) 中文繁體 (zh-TW)

557 results for: in tag: c#

Identify an event via a Linq Expression tree

The compiler usually chokes when an event doesn't appear beside a ...+=... or a ...-=..., so I'm not sure if this is possible....I want to be able to identify an event by using an Expression tree, so I can create an event watcher for a test. The syntax wo...
c# expression-trees linq
asked by user1228

Serializing and Deserializing Expression Trees in C#

Is there a way to Deserialize Expressions in C#, I would like to store Expressions in a Database and load them at run time.
c# expression-trees serialization
asked by Alexandre Brisebois

Lambda Expression Tree Parsing

I am trying to use Lambda Expressions in a project to map to a third party query API. So, I'm parsing the Expression tree by hand....If I pass in a lambda expression like:...p => p.Title == "title" ...everything works....However, if my lambda expression l...
c# expression-trees lambda
asked by Keith Fitzgerald

Given a type ExpressionType.MemberAccess, how do i get the field value?

I am parsing an Expression Tree. Given a NodeType of ExpressionType.MemberAccess, how do I get the value of that Field? ...From C# MSDN docs: MemberAccess is A node that represents reading from a field or property. ...A code snippet would be incredibly, ...
c# expression-trees reflection
asked by Keith Fitzgerald

How do I apply OrderBy on an IQueryable using a string column name within a generic extension method?

public static IQueryable<TResult> ApplySortFilter<T, TResult>(this IQueryable<T> query, string columnName) where T : EntityObject { var param = Expression.Parameter(typeof(T), "o"); var body = Expression.PropertyOrField(param,columnName); var sor...
.net c# entity-framework expression-trees linq
asked by JTew

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

Given:...FieldInfo field = <some valid string field on type T>; ParameterExpression targetExp = Expression.Parameter(typeof(T), "target"); ParameterExpression valueExp = Expression.Parameter(typeof(string), "value"); ...How do I compile a lambda expressio...
c# expression-trees lambda
asked by TheSoftwareJedi

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"); ...Shortened for clarity, I have the following:...//'myObject.childObjectCollection' is represented here by 'propertyExp' ...
.net c# expression-trees linq
asked by flesh

How do I Create an Expression Tree by Parsing Xml in C#?

I am looking to create an expression tree by parsing xml using C#. The xml would be like the following:...<Expression> <If> <Condition> <GreaterThan> <X> <Y> </GreaterThan> </Condition> <Expression /> <If> <Else> <Expression />...
.net c# expression-trees linq xml
asked by SharePoint Newbie

In LINQ to SQL, how do you pass parts of a LINQ query into a function

Is it possible to pass parts of a linq Query into a function? I want create a common interface for my DAL that always uses the same query interface. For example, ...List<T> Get(Join j, Where w, Select s){ return currentDataContext<T>.Join(j).Wh...
c# expression-trees linq linq-to-sql
asked by Arron S

how to create expression tree / lambda for a deep property from a string

Given a string: "Person.Address.Postcode" I want to be able to get/set this postcode property on an instance of Person. How can I do this? My idea was to split the string by "." and then iterate over the parts, looking for the property on the previous typ...
c# expression-trees lambda
asked by Andrew Bullock

C# Dynamic Trees for Genetic Programming

I have some public user defined classes with relations between their members and also several methods with specific and generic signatures....I would like to be able to store and manipulate custom control flow over these classes (plus CLR classes) using b...
c# expression-trees genetic-programming
asked by wilsonlarg

How to create LINQ Expression Tree to select an anonymous type

I would like to generate the following select statement dynamically using expression trees:...var v = from c in Countries where c.City == "London" select new {c.Name, c.Population}; ...I have worked out how to generate...var v = from c in ...
c# entity-framework expression-trees linq linq-to-entities
asked by Tom Deloford

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 they're useful?...edit: I'm talking about the LINQ feature in .Net.
.net c# expression-trees linq
asked by Dave

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 ...Expression<Func<SomeType, bool>> originalPredicate..., I want to create an ...Expression<Func<OtherType, bool>> translatedPredicate.......In th...
c# expression-trees lambda linq-to-sql repository-pattern
asked by Michiel van Oosterhout

Retrieving Property name from lambda expression

Is there a better way to get the Property name when passed in via a lambda expression? Here is what i currently have....eg. ...GetSortingInfo<User>(u => u.UserId); ...It worked by casting it as a memberexpression only when the property was a string. beca...
c# expression-trees lambda linq
asked by Schotime

Performing part of a IQueryable query and deferring the rest to Linq for Objects

I have a Linq provider that sucessfully goes and gets data from my chosen datasource, but what I would like to do now that I have my filtered resultset, is allow Linq to Objects to process the rest of the Expression tree (for things like Joins, projection...
c# expression-trees iqueryable linq
asked by Tim Jarvis

Is there an easy way to parse a (lambda expression) string into an Action delegate?

I have a method that alters an "Account" object based on the action delegate passed into it:...public static void AlterAccount(string AccountID, Action<Account> AccountAction) { Account someAccount = accountRepository.GetAccount(AccountID); AccountAct...
.net c# expression-trees linq parsing
asked by Whisk

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>(); return table.ToList().SingleOrDefault(e => Convert.ToInt16(e.GetType().GetProperties().First().GetValue(e, null)) == id); } ...
c# expression-trees generics linq-to-sql
asked by Andreas Grech

How to convert an equation into formulas for individual variables?

How to convert an equation into formulas for individual variables? I am thinking about a math equations like:...c^2 = a^2 + b^2 ...I would like to have a function that could process any formula, and give me the individual variable formulas. The above equ...
.net c# expression-trees logic math
asked by Bobby Ortiz

C#: How to parse arbitrary strings into expression trees?

In a project that I'm working on I have to work with a rather weird data source. I can give it a "query" and it will return me a DataTable. But the query is not a traditional string. It's more like... a set of method calls that define the criteria that I ...
.net c# expression-trees parsing
asked by Vilx-

Page 1 of 28
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • …
  • »
  • »»

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...