Imports System.Linq.Expressions
Dim pe As ParameterExpression = Expression.Parameter(GetType(Student), "s")
Dim mexp As MemberExpression = Expression.Property(pe, "Age")
Dim constant As ConstantExpression = Expression.Constant(18, GetType(Integer))
Dim body As BinaryExpression = Expression.GreaterThanOrEqual(mexp, constant)
Dim ExpressionTree As Expression(Of Func(Of Student, Boolean)) =
Expression.Lambda(Of Func(Of Student, Boolean))(body, New ParameterExpression() {pe})
Console.WriteLine("Expression Tree: {0}", ExpressionTree)
Console.WriteLine("Expression Tree Body: {0}", ExpressionTree.Body)
Console.WriteLine("Number of Parameters in Expression Tree: {0}",
ExpressionTree.Parameters.Count)
Console.WriteLine("Parameters in Expression Tree: {0}", ExpressionTree.Parameters(0))
Private _studentID As integer
Private _studentName As string
Property StudentID() As integer
Set(ByVal Value As integer)
Property StudentName() As string
Set(ByVal Value As string)
Property Age() As integer
Set(ByVal Value As integer)