mscorlib(4.0.0.0) API with additions
MethodCallExpression.cs
3 using System.Diagnostics;
4 using System.Dynamic.Utils;
5 using System.Reflection;
6 
8 {
10  [DebuggerTypeProxy(typeof(MethodCallExpressionProxy))]
11  [global::__DynamicallyInvokable]
13  {
14  private readonly MethodInfo _method;
15 
18  [global::__DynamicallyInvokable]
19  public sealed override ExpressionType NodeType
20  {
21  [global::__DynamicallyInvokable]
22  get
23  {
24  return ExpressionType.Call;
25  }
26  }
27 
30  [global::__DynamicallyInvokable]
31  public sealed override Type Type
32  {
33  [global::__DynamicallyInvokable]
34  get
35  {
36  return _method.ReturnType;
37  }
38  }
39 
42  [global::__DynamicallyInvokable]
43  public MethodInfo Method
44  {
45  [global::__DynamicallyInvokable]
46  get
47  {
48  return _method;
49  }
50  }
51 
54  [global::__DynamicallyInvokable]
55  public Expression Object
56  {
57  [global::__DynamicallyInvokable]
58  get
59  {
60  return GetInstance();
61  }
62  }
63 
66  [global::__DynamicallyInvokable]
68  {
69  [global::__DynamicallyInvokable]
70  get
71  {
72  return GetOrMakeArguments();
73  }
74  }
75 
78  [global::__DynamicallyInvokable]
80  {
81  [global::__DynamicallyInvokable]
82  get
83  {
84  throw ContractUtils.Unreachable;
85  }
86  }
87 
88  internal MethodCallExpression(MethodInfo method)
89  {
90  _method = method;
91  }
92 
93  internal virtual Expression GetInstance()
94  {
95  return null;
96  }
97 
102  [global::__DynamicallyInvokable]
104  {
105  if (@object == Object && arguments == Arguments)
106  {
107  return this;
108  }
109  return Expression.Call(@object, Method, arguments);
110  }
111 
112  internal virtual ReadOnlyCollection<Expression> GetOrMakeArguments()
113  {
114  throw ContractUtils.Unreachable;
115  }
116 
120  [global::__DynamicallyInvokable]
121  protected internal override Expression Accept(ExpressionVisitor visitor)
122  {
123  return visitor.VisitMethodCall(this);
124  }
125 
126  internal virtual MethodCallExpression Rewrite(Expression instance, IList<Expression> args)
127  {
128  throw ContractUtils.Unreachable;
129  }
130 
134  [global::__DynamicallyInvokable]
135  Expression IArgumentProvider.GetArgument(int index)
136  {
137  throw ContractUtils.Unreachable;
138  }
139  }
140 }
MethodInfo Method
Gets the T:System.Reflection.MethodInfo for the method to be called.
Provides the base class for a generic read-only collection.
Discovers the attributes of a method and provides access to method metadata.
Definition: MethodInfo.cs:13
Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived...
Definition: Object.cs:18
Provides an internal interface for accessing the arguments of multiple tree nodes (DynamicExpression,...
Definition: __Canon.cs:3
Exposes the enumerator, which supports a simple iteration over a collection of a specified type....
Definition: IEnumerable.cs:9
int ArgumentCount
Returns the number of arguments to the expression tree node. You should not use this type....
internal override Expression Accept(ExpressionVisitor visitor)
Dispatches to the specific visit method for this node type. For example, T:System....
Provides the base class from which the classes that represent expression tree nodes are derived....
Definition: Expression.cs:17
MethodCallExpression Update(Expression @object, IEnumerable< Expression > arguments)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
ReadOnlyCollection< Expression > Arguments
Gets a collection of expressions that represent arguments of the called method.
ExpressionType
Describes the node types for the nodes of an expression tree.
sealed override ExpressionType NodeType
Returns the node type of this T:System.Linq.Expressions.Expression.
Represents a collection of objects that can be individually accessed by index.
Definition: IList.cs:9
Represents a call to either static or an instance method.
virtual internal Expression VisitMethodCall(MethodCallExpression node)
Visits the children of the T:System.Linq.Expressions.MethodCallExpression.
Represents a visitor or rewriter for expression trees.