ParameterExpression Class

Definition

Represents a named parameter expression.

public class ParameterExpression : System.Linq.Expressions.Expression
Inheritance
ParameterExpression

Examples

The following example demonstrates how to create a MethodCallExpression object that prints the value of a ParameterExpression object by using the Parameter method.

// Add the following directive to the file:
// using System.Linq.Expressions;  

// Creating a parameter for the expression tree.
ParameterExpression param = Expression.Parameter(typeof(int));

// Creating an expression for the method call and specifying its parameter.
MethodCallExpression methodCall = Expression.Call(
    typeof(Console).GetMethod("WriteLine", new Type[] { typeof(int) }),
    param
);

// The following statement first creates an expression tree,
// then compiles it, and then runs it.
Expression.Lambda<Action<int>>(
    methodCall,
    new ParameterExpression[] { param }
).Compile()(10);

// This code example produces the following output:
//
// 10
' Add the following directive to the file:
' Imports System.Linq.Expressions 

' Creating a parameter for the expression tree.
Dim param As ParameterExpression = Expression.Parameter(GetType(Integer))

' Creating an expression for the method call and specifying its parameter.
Dim methodCall As MethodCallExpression = Expression.Call(
        GetType(Console).GetMethod("WriteLine", New Type() {GetType(Integer)}),
        param
    )

' Compiling and invoking the methodCall expression.
Expression.Lambda(Of Action(Of Integer))(
    methodCall,
    New ParameterExpression() {param}
).Compile()(10)
' This code example produces the following output:
'
' 10

Remarks

Use the Parameter factory method to create a ParameterExpression.

The value of the NodeType property of a ParameterExpression object is Parameter.

Properties

CanReduce Inherited from Expression
IsByRef

Indicates that this ParameterExpression is to be treated as a ByRef parameter.

Name

Gets the name of the parameter or variable.

NodeType

Returns the node type of this Expression.

Type

Gets the static type of the expression that this Expression represents.

Methods

Accept(ExpressionVisitor)

Dispatches to the specific visit method for this node type. For example, MethodCallExpression calls the VisitMethodCall(MethodCallExpression).

Add(Expression, Expression) Inherited from Expression
Add(Expression, Expression, MethodInfo) Inherited from Expression
AddAssign(Expression, Expression) Inherited from Expression
AddAssign(Expression, Expression, MethodInfo) Inherited from Expression
AddAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
AddAssignChecked(Expression, Expression) Inherited from Expression
AddAssignChecked(Expression, Expression, MethodInfo) Inherited from Expression
AddAssignChecked(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
AddChecked(Expression, Expression) Inherited from Expression
AddChecked(Expression, Expression, MethodInfo) Inherited from Expression
And(Expression, Expression) Inherited from Expression
And(Expression, Expression, MethodInfo) Inherited from Expression
AndAlso(Expression, Expression) Inherited from Expression
AndAlso(Expression, Expression, MethodInfo) Inherited from Expression
AndAssign(Expression, Expression) Inherited from Expression
AndAssign(Expression, Expression, MethodInfo) Inherited from Expression
AndAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
ArrayAccess(Expression, Expression[]) Inherited from Expression
ArrayAccess(Expression, IEnumerable<Expression>) Inherited from Expression
ArrayIndex(Expression, Expression) Inherited from Expression
ArrayIndex(Expression, Expression[]) Inherited from Expression
ArrayIndex(Expression, IEnumerable<Expression>) Inherited from Expression
ArrayLength(Expression) Inherited from Expression
Assign(Expression, Expression) Inherited from Expression
Bind(MemberInfo, Expression) Inherited from Expression
Bind(MethodInfo, Expression) Inherited from Expression
Block(Expression, Expression) Inherited from Expression
Block(Expression, Expression, Expression) Inherited from Expression
Block(Expression, Expression, Expression, Expression) Inherited from Expression
Block(Expression, Expression, Expression, Expression, Expression) Inherited from Expression
Block(Expression[]) Inherited from Expression
Block(IEnumerable<Expression>) Inherited from Expression
Block(IEnumerable<ParameterExpression>, Expression[]) Inherited from Expression
Block(IEnumerable<ParameterExpression>, IEnumerable<Expression>) Inherited from Expression
Block(Type, Expression[]) Inherited from Expression
Block(Type, IEnumerable<Expression>) Inherited from Expression
Block(Type, IEnumerable<ParameterExpression>, Expression[]) Inherited from Expression
Block(Type, IEnumerable<ParameterExpression>, IEnumerable<Expression>) Inherited from Expression
Break(LabelTarget) Inherited from Expression
Break(LabelTarget, Expression) Inherited from Expression
Break(LabelTarget, Expression, Type) Inherited from Expression
Break(LabelTarget, Type) Inherited from Expression
Call(Expression, MethodInfo) Inherited from Expression
Call(Expression, MethodInfo, Expression, Expression) Inherited from Expression
Call(Expression, MethodInfo, Expression, Expression, Expression) Inherited from Expression
Call(Expression, MethodInfo, Expression[]) Inherited from Expression
Call(Expression, MethodInfo, IEnumerable<Expression>) Inherited from Expression
Call(Expression, String, Type[], Expression[]) Inherited from Expression
Call(MethodInfo, Expression) Inherited from Expression
Call(MethodInfo, Expression, Expression) Inherited from Expression
Call(MethodInfo, Expression, Expression, Expression) Inherited from Expression
Call(MethodInfo, Expression, Expression, Expression, Expression) Inherited from Expression
Call(MethodInfo, Expression, Expression, Expression, Expression, Expression) Inherited from Expression
Call(MethodInfo, Expression[]) Inherited from Expression
Call(MethodInfo, IEnumerable<Expression>) Inherited from Expression
Call(Type, String, Type[], Expression[]) Inherited from Expression
Catch(ParameterExpression, Expression) Inherited from Expression
Catch(ParameterExpression, Expression, Expression) Inherited from Expression
Catch(Type, Expression) Inherited from Expression
Catch(Type, Expression, Expression) Inherited from Expression
ClearDebugInfo(SymbolDocumentInfo) Inherited from Expression
Coalesce(Expression, Expression) Inherited from Expression
Coalesce(Expression, Expression, LambdaExpression) Inherited from Expression
Condition(Expression, Expression, Expression) Inherited from Expression
Condition(Expression, Expression, Expression, Type) Inherited from Expression
Constant(Object) Inherited from Expression
Constant(Object, Type) Inherited from Expression
Continue(LabelTarget) Inherited from Expression
Continue(LabelTarget, Type) Inherited from Expression
Convert(Expression, Type) Inherited from Expression
Convert(Expression, Type, MethodInfo) Inherited from Expression
ConvertChecked(Expression, Type) Inherited from Expression
ConvertChecked(Expression, Type, MethodInfo) Inherited from Expression
DebugInfo(SymbolDocumentInfo, Int32, Int32, Int32, Int32) Inherited from Expression
Decrement(Expression) Inherited from Expression
Decrement(Expression, MethodInfo) Inherited from Expression
Default(Type) Inherited from Expression
Divide(Expression, Expression) Inherited from Expression
Divide(Expression, Expression, MethodInfo) Inherited from Expression
DivideAssign(Expression, Expression) Inherited from Expression
DivideAssign(Expression, Expression, MethodInfo) Inherited from Expression
DivideAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
Dynamic(CallSiteBinder, Type, Expression) Inherited from Expression
Dynamic(CallSiteBinder, Type, Expression, Expression) Inherited from Expression
Dynamic(CallSiteBinder, Type, Expression, Expression, Expression) Inherited from Expression
Dynamic(CallSiteBinder, Type, Expression, Expression, Expression, Expression) Inherited from Expression
Dynamic(CallSiteBinder, Type, Expression[]) Inherited from Expression
Dynamic(CallSiteBinder, Type, IEnumerable<Expression>) Inherited from Expression
ElementInit(MethodInfo, Expression[]) Inherited from Expression
ElementInit(MethodInfo, IEnumerable<Expression>) Inherited from Expression
Empty() Inherited from Expression
Equal(Expression, Expression) Inherited from Expression
Equal(Expression, Expression, Boolean, MethodInfo) Inherited from Expression
Equals(Object) Inherited from Object
Equals(Object, Object) Inherited from Object
ExclusiveOr(Expression, Expression) Inherited from Expression
ExclusiveOr(Expression, Expression, MethodInfo) Inherited from Expression
ExclusiveOrAssign(Expression, Expression) Inherited from Expression
ExclusiveOrAssign(Expression, Expression, MethodInfo) Inherited from Expression
ExclusiveOrAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
Field(Expression, FieldInfo) Inherited from Expression
Field(Expression, String) Inherited from Expression
Field(Expression, Type, String) Inherited from Expression
GetActionType(Type[]) Inherited from Expression
GetDelegateType(Type[]) Inherited from Expression
GetFuncType(Type[]) Inherited from Expression
GetHashCode() Inherited from Object
GetType() Inherited from Object
Goto(LabelTarget) Inherited from Expression
Goto(LabelTarget, Expression) Inherited from Expression
Goto(LabelTarget, Expression, Type) Inherited from Expression
Goto(LabelTarget, Type) Inherited from Expression
GreaterThan(Expression, Expression) Inherited from Expression
GreaterThan(Expression, Expression, Boolean, MethodInfo) Inherited from Expression
GreaterThanOrEqual(Expression, Expression) Inherited from Expression
GreaterThanOrEqual(Expression, Expression, Boolean, MethodInfo) Inherited from Expression
IfThen(Expression, Expression) Inherited from Expression
IfThenElse(Expression, Expression, Expression) Inherited from Expression
Increment(Expression) Inherited from Expression
Increment(Expression, MethodInfo) Inherited from Expression
Invoke(Expression, Expression[]) Inherited from Expression
Invoke(Expression, IEnumerable<Expression>) Inherited from Expression
IsFalse(Expression) Inherited from Expression
IsFalse(Expression, MethodInfo) Inherited from Expression
IsTrue(Expression) Inherited from Expression
IsTrue(Expression, MethodInfo) Inherited from Expression
Label() Inherited from Expression
Label(LabelTarget) Inherited from Expression
Label(LabelTarget, Expression) Inherited from Expression
Label(String) Inherited from Expression
Label(Type) Inherited from Expression
Label(Type, String) Inherited from Expression
Lambda(Expression, Boolean, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda(Expression, Boolean, ParameterExpression[]) Inherited from Expression
Lambda(Expression, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda(Expression, ParameterExpression[]) Inherited from Expression
Lambda(Expression, String, Boolean, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda(Expression, String, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda(Type, Expression, Boolean, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda(Type, Expression, Boolean, ParameterExpression[]) Inherited from Expression
Lambda(Type, Expression, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda(Type, Expression, ParameterExpression[]) Inherited from Expression
Lambda(Type, Expression, String, Boolean, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda(Type, Expression, String, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda<TDelegate>(Expression, Boolean, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda<TDelegate>(Expression, Boolean, ParameterExpression[]) Inherited from Expression
Lambda<TDelegate>(Expression, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda<TDelegate>(Expression, ParameterExpression[]) Inherited from Expression
Lambda<TDelegate>(Expression, String, Boolean, IEnumerable<ParameterExpression>) Inherited from Expression
Lambda<TDelegate>(Expression, String, IEnumerable<ParameterExpression>) Inherited from Expression
LeftShift(Expression, Expression) Inherited from Expression
LeftShift(Expression, Expression, MethodInfo) Inherited from Expression
LeftShiftAssign(Expression, Expression) Inherited from Expression
LeftShiftAssign(Expression, Expression, MethodInfo) Inherited from Expression
LeftShiftAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
LessThan(Expression, Expression) Inherited from Expression
LessThan(Expression, Expression, Boolean, MethodInfo) Inherited from Expression
LessThanOrEqual(Expression, Expression) Inherited from Expression
LessThanOrEqual(Expression, Expression, Boolean, MethodInfo) Inherited from Expression
ListBind(MemberInfo, ElementInit[]) Inherited from Expression
ListBind(MemberInfo, IEnumerable<ElementInit>) Inherited from Expression
ListBind(MethodInfo, ElementInit[]) Inherited from Expression
ListBind(MethodInfo, IEnumerable<ElementInit>) Inherited from Expression
ListInit(NewExpression, ElementInit[]) Inherited from Expression
ListInit(NewExpression, Expression[]) Inherited from Expression
ListInit(NewExpression, IEnumerable<ElementInit>) Inherited from Expression
ListInit(NewExpression, IEnumerable<Expression>) Inherited from Expression
ListInit(NewExpression, MethodInfo, Expression[]) Inherited from Expression
ListInit(NewExpression, MethodInfo, IEnumerable<Expression>) Inherited from Expression
Loop(Expression) Inherited from Expression
Loop(Expression, LabelTarget) Inherited from Expression
Loop(Expression, LabelTarget, LabelTarget) Inherited from Expression
MakeBinary(ExpressionType, Expression, Expression) Inherited from Expression
MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo) Inherited from Expression
MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo, LambdaExpression) Inherited from Expression
MakeCatchBlock(Type, ParameterExpression, Expression, Expression) Inherited from Expression
MakeDynamic(Type, CallSiteBinder, Expression) Inherited from Expression
MakeDynamic(Type, CallSiteBinder, Expression, Expression) Inherited from Expression
MakeDynamic(Type, CallSiteBinder, Expression, Expression, Expression) Inherited from Expression
MakeDynamic(Type, CallSiteBinder, Expression, Expression, Expression, Expression) Inherited from Expression
MakeDynamic(Type, CallSiteBinder, Expression[]) Inherited from Expression
MakeDynamic(Type, CallSiteBinder, IEnumerable<Expression>) Inherited from Expression
MakeGoto(GotoExpressionKind, LabelTarget, Expression, Type) Inherited from Expression
MakeIndex(Expression, PropertyInfo, IEnumerable<Expression>) Inherited from Expression
MakeMemberAccess(Expression, MemberInfo) Inherited from Expression
MakeTry(Type, Expression, Expression, Expression, IEnumerable<CatchBlock>) Inherited from Expression
MakeUnary(ExpressionType, Expression, Type) Inherited from Expression
MakeUnary(ExpressionType, Expression, Type, MethodInfo) Inherited from Expression
MemberBind(MemberInfo, IEnumerable<MemberBinding>) Inherited from Expression
MemberBind(MemberInfo, MemberBinding[]) Inherited from Expression
MemberBind(MethodInfo, IEnumerable<MemberBinding>) Inherited from Expression
MemberBind(MethodInfo, MemberBinding[]) Inherited from Expression
MemberInit(NewExpression, IEnumerable<MemberBinding>) Inherited from Expression
MemberInit(NewExpression, MemberBinding[]) Inherited from Expression
MemberwiseClone() Inherited from Object
Modulo(Expression, Expression) Inherited from Expression
Modulo(Expression, Expression, MethodInfo) Inherited from Expression
ModuloAssign(Expression, Expression) Inherited from Expression
ModuloAssign(Expression, Expression, MethodInfo) Inherited from Expression
ModuloAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
Multiply(Expression, Expression) Inherited from Expression
Multiply(Expression, Expression, MethodInfo) Inherited from Expression
MultiplyAssign(Expression, Expression) Inherited from Expression
MultiplyAssign(Expression, Expression, MethodInfo) Inherited from Expression
MultiplyAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
MultiplyAssignChecked(Expression, Expression) Inherited from Expression
MultiplyAssignChecked(Expression, Expression, MethodInfo) Inherited from Expression
MultiplyAssignChecked(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
MultiplyChecked(Expression, Expression) Inherited from Expression
MultiplyChecked(Expression, Expression, MethodInfo) Inherited from Expression
Negate(Expression) Inherited from Expression
Negate(Expression, MethodInfo) Inherited from Expression
NegateChecked(Expression) Inherited from Expression
NegateChecked(Expression, MethodInfo) Inherited from Expression
New(ConstructorInfo) Inherited from Expression
New(ConstructorInfo, Expression[]) Inherited from Expression
New(ConstructorInfo, IEnumerable<Expression>) Inherited from Expression
New(ConstructorInfo, IEnumerable<Expression>, IEnumerable<MemberInfo>) Inherited from Expression
New(ConstructorInfo, IEnumerable<Expression>, MemberInfo[]) Inherited from Expression
New(Type) Inherited from Expression
NewArrayBounds(Type, Expression[]) Inherited from Expression
NewArrayBounds(Type, IEnumerable<Expression>) Inherited from Expression
NewArrayInit(Type, Expression[]) Inherited from Expression
NewArrayInit(Type, IEnumerable<Expression>) Inherited from Expression
Not(Expression) Inherited from Expression
Not(Expression, MethodInfo) Inherited from Expression
NotEqual(Expression, Expression) Inherited from Expression
NotEqual(Expression, Expression, Boolean, MethodInfo) Inherited from Expression
OnesComplement(Expression) Inherited from Expression
OnesComplement(Expression, MethodInfo) Inherited from Expression
Or(Expression, Expression) Inherited from Expression
Or(Expression, Expression, MethodInfo) Inherited from Expression
OrAssign(Expression, Expression) Inherited from Expression
OrAssign(Expression, Expression, MethodInfo) Inherited from Expression
OrAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
OrElse(Expression, Expression) Inherited from Expression
OrElse(Expression, Expression, MethodInfo) Inherited from Expression
Parameter(Type) Inherited from Expression
Parameter(Type, String) Inherited from Expression
PostDecrementAssign(Expression) Inherited from Expression
PostDecrementAssign(Expression, MethodInfo) Inherited from Expression
PostIncrementAssign(Expression) Inherited from Expression
PostIncrementAssign(Expression, MethodInfo) Inherited from Expression
Power(Expression, Expression) Inherited from Expression
Power(Expression, Expression, MethodInfo) Inherited from Expression
PowerAssign(Expression, Expression) Inherited from Expression
PowerAssign(Expression, Expression, MethodInfo) Inherited from Expression
PowerAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
PreDecrementAssign(Expression) Inherited from Expression
PreDecrementAssign(Expression, MethodInfo) Inherited from Expression
PreIncrementAssign(Expression) Inherited from Expression
PreIncrementAssign(Expression, MethodInfo) Inherited from Expression
Property(Expression, MethodInfo) Inherited from Expression
Property(Expression, PropertyInfo) Inherited from Expression
Property(Expression, PropertyInfo, Expression[]) Inherited from Expression
Property(Expression, PropertyInfo, IEnumerable<Expression>) Inherited from Expression
Property(Expression, String) Inherited from Expression
Property(Expression, String, Expression[]) Inherited from Expression
Property(Expression, Type, String) Inherited from Expression
PropertyOrField(Expression, String) Inherited from Expression
Quote(Expression) Inherited from Expression
Reduce() Inherited from Expression
ReduceAndCheck() Inherited from Expression
ReduceExtensions() Inherited from Expression
ReferenceEqual(Expression, Expression) Inherited from Expression
ReferenceEquals(Object, Object) Inherited from Object
ReferenceNotEqual(Expression, Expression) Inherited from Expression
Rethrow() Inherited from Expression
Rethrow(Type) Inherited from Expression
Return(LabelTarget) Inherited from Expression
Return(LabelTarget, Expression) Inherited from Expression
Return(LabelTarget, Expression, Type) Inherited from Expression
Return(LabelTarget, Type) Inherited from Expression
RightShift(Expression, Expression) Inherited from Expression
RightShift(Expression, Expression, MethodInfo) Inherited from Expression
RightShiftAssign(Expression, Expression) Inherited from Expression
RightShiftAssign(Expression, Expression, MethodInfo) Inherited from Expression
RightShiftAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
RuntimeVariables(IEnumerable<ParameterExpression>) Inherited from Expression
RuntimeVariables(ParameterExpression[]) Inherited from Expression
Subtract(Expression, Expression) Inherited from Expression
Subtract(Expression, Expression, MethodInfo) Inherited from Expression
SubtractAssign(Expression, Expression) Inherited from Expression
SubtractAssign(Expression, Expression, MethodInfo) Inherited from Expression
SubtractAssign(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
SubtractAssignChecked(Expression, Expression) Inherited from Expression
SubtractAssignChecked(Expression, Expression, MethodInfo) Inherited from Expression
SubtractAssignChecked(Expression, Expression, MethodInfo, LambdaExpression) Inherited from Expression
SubtractChecked(Expression, Expression) Inherited from Expression
SubtractChecked(Expression, Expression, MethodInfo) Inherited from Expression
Switch(Expression, Expression, MethodInfo, IEnumerable<SwitchCase>) Inherited from Expression
Switch(Expression, Expression, MethodInfo, SwitchCase[]) Inherited from Expression
Switch(Expression, Expression, SwitchCase[]) Inherited from Expression
Switch(Expression, SwitchCase[]) Inherited from Expression
Switch(Type, Expression, Expression, MethodInfo, IEnumerable<SwitchCase>) Inherited from Expression
Switch(Type, Expression, Expression, MethodInfo, SwitchCase[]) Inherited from Expression
SwitchCase(Expression, Expression[]) Inherited from Expression
SwitchCase(Expression, IEnumerable<Expression>) Inherited from Expression
SymbolDocument(String) Inherited from Expression
SymbolDocument(String, Guid) Inherited from Expression
SymbolDocument(String, Guid, Guid) Inherited from Expression
SymbolDocument(String, Guid, Guid, Guid) Inherited from Expression
Throw(Expression) Inherited from Expression
Throw(Expression, Type) Inherited from Expression
ToString() Inherited from Expression
TryCatch(Expression, CatchBlock[]) Inherited from Expression
TryCatchFinally(Expression, Expression, CatchBlock[]) Inherited from Expression
TryFault(Expression, Expression) Inherited from Expression
TryFinally(Expression, Expression) Inherited from Expression
TryGetActionType(Type[], Type) Inherited from Expression
TryGetFuncType(Type[], Type) Inherited from Expression
TypeAs(Expression, Type) Inherited from Expression
TypeEqual(Expression, Type) Inherited from Expression
TypeIs(Expression, Type) Inherited from Expression
UnaryPlus(Expression) Inherited from Expression
UnaryPlus(Expression, MethodInfo) Inherited from Expression
Unbox(Expression, Type) Inherited from Expression
Variable(Type) Inherited from Expression
Variable(Type, String) Inherited from Expression
VisitChildren(ExpressionVisitor) Inherited from Expression

Applies to