LINQ – Compiling Expression Tree

LINQ - C#

 

using (var repository = new DbEntities())
{
	Expression<Func<User, bool>> expression = user => user.UserId != 5;
	var usrs = repository.Users.ToList();
	var compiledExpression = expression.Compile();
	var user2ndQuery = usrs.Where(compiledExpression);
}
This entry was posted in .Net, LINQ, Visual C# .Net. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *