ParameterExpression 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示一个命名的参数表达式。
public ref class ParameterExpression : System::Linq::Expressions::Expressionpublic ref class ParameterExpression sealed : System::Linq::Expressions::Expressionpublic class ParameterExpression : System.Linq.Expressions.Expressionpublic sealed class ParameterExpression : System.Linq.Expressions.Expressiontype ParameterExpression = class
    inherit ExpressionPublic Class ParameterExpression
Inherits ExpressionPublic NotInheritable Class ParameterExpression
Inherits Expression- 继承
示例
下面的示例演示如何使用 Parameter 方法创建MethodCallExpression打印 对象值的 ParameterExpression 对象。
// 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
注解
Parameter使用工厂方法创建 ParameterExpression。
对象的 Parameter属性的ParameterExpression值为 NodeType 。
属性
| CanReduce | 指示可将节点简化为更简单的节点。 如果返回 true,则可以调用 Reduce() 以生成简化形式。(继承自 Expression) | 
| IsByRef | 指示将其  | 
| Name | 获取参数或变量的名称。 | 
| NodeType | 返回此 Expression 的节点类型。 | 
| NodeType | 获取此 Expression 的节点类型。(继承自 Expression) | 
| Type | 获取此 Expression 表示的表达式的静态类型。 | 
| Type | 获取此 Expression 表示的表达式的静态类型。(继承自 Expression) | 
方法
| Accept(ExpressionVisitor) | 调度到此节点类型的特定 Visit 方法。 例如,MethodCallExpression 调用 VisitMethodCall(MethodCallExpression)。 | 
| Accept(ExpressionVisitor) | 调度到此节点类型的特定 Visit 方法。 例如,MethodCallExpression 调用 VisitMethodCall(MethodCallExpression)。(继承自 Expression) | 
| Equals(Object) | 确定指定对象是否等于当前对象。(继承自 Object) | 
| GetHashCode() | 作为默认哈希函数。(继承自 Object) | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| Reduce() | 将此节点简化为更简单的表达式。 如果 CanReduce 返回 true,则它应返回有效的表达式。 此方法可以返回本身必须简化的另一个节点。(继承自 Expression) | 
| ReduceAndCheck() | 将此节点简化为更简单的表达式。 如果 CanReduce 返回 true,则它应返回有效的表达式。 此方法可以返回本身必须简化的另一个节点。(继承自 Expression) | 
| ReduceExtensions() | 将表达式简化为已知节点类型(即非 Extension 节点)或仅在此类型为已知类型时返回表达式。(继承自 Expression) | 
| ToString() | 返回 Expression 的的文本化表示形式。(继承自 Expression) | 
| VisitChildren(ExpressionVisitor) | 简化节点,然后对简化的表达式调用访问者委托。 该方法在节点不可简化时引发异常。(继承自 Expression) |