LINQ – Bool Expression

LINQ - C#

 

 using (var repository = new DbEntities())
{
	Expression<Func<User, bool>> expression = user => user.UserId != 5;

	ParameterExpression param = (ParameterExpression)expression.Parameters[0];
	BinaryExpression operation = (BinaryExpression)expression.Body;
	var left = operation.Left;
	var right = operation.Right;
	var usr = repository.Users.Where(expression).FirstOrDefault();
}
This entry was posted in .Net, Visual C# .Net and tagged , , . Bookmark the permalink.

Leave a Reply

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