using System.Linq.Expressions; ParameterExpression a = Expression.Parameter(typeof(int), "a"); ParameterExpression b = Expression.Parameter(typeof(int), "b"); BinaryExpression add = Expression.Add(a, b);
ParameterExpression s1 = Expression.Parameter(typeof(string), "s1"); ParameterExpression s2 = Expression.Parameter(typeof(string), "s2"); BinaryExpression equals = Expression.Equal(s1, s2);In this example, we are creating two ParameterExpressions representing string values and creating a BinaryExpression that represents the equality comparison operation between those two values. The System.Linq.Expressions.BinaryExpression class is part of the System.Core.dll library, which is included in the .NET Framework and .NET Core frameworks.