mscorlib(4.0.0.0) API with additions
DynamicObject.cs
2 using System.Dynamic.Utils;
4 using System.Reflection;
6 
7 namespace System.Dynamic
8 {
10  [Serializable]
11  [global::__DynamicallyInvokable]
13  {
14  private sealed class MetaDynamic : DynamicMetaObject
15  {
16  private delegate DynamicMetaObject Fallback(DynamicMetaObject errorSuggestion);
17 
18  private sealed class GetBinderAdapter : GetMemberBinder
19  {
20  internal GetBinderAdapter(InvokeMemberBinder binder)
21  : base(binder.Name, binder.IgnoreCase)
22  {
23  }
24 
25  public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
26  {
27  throw new NotSupportedException();
28  }
29  }
30 
31  private static readonly Expression[] NoArgs = new Expression[0];
32 
33  private new DynamicObject Value => (DynamicObject)base.Value;
34 
35  internal MetaDynamic(Expression expression, DynamicObject value)
36  : base(expression, BindingRestrictions.Empty, value)
37  {
38  }
39 
41  {
42  return Value.GetDynamicMemberNames();
43  }
44 
45  public override DynamicMetaObject BindGetMember(GetMemberBinder binder)
46  {
47  if (IsOverridden("TryGetMember"))
48  {
49  return CallMethodWithResult("TryGetMember", binder, NoArgs, (DynamicMetaObject e) => binder.FallbackGetMember(this, e));
50  }
51  return base.BindGetMember(binder);
52  }
53 
54  public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value)
55  {
56  if (IsOverridden("TrySetMember"))
57  {
58  return CallMethodReturnLast("TrySetMember", binder, NoArgs, value.Expression, (DynamicMetaObject e) => binder.FallbackSetMember(this, value, e));
59  }
60  return base.BindSetMember(binder, value);
61  }
62 
63  public override DynamicMetaObject BindDeleteMember(DeleteMemberBinder binder)
64  {
65  if (IsOverridden("TryDeleteMember"))
66  {
67  return CallMethodNoResult("TryDeleteMember", binder, NoArgs, (DynamicMetaObject e) => binder.FallbackDeleteMember(this, e));
68  }
69  return base.BindDeleteMember(binder);
70  }
71 
72  public override DynamicMetaObject BindConvert(ConvertBinder binder)
73  {
74  if (IsOverridden("TryConvert"))
75  {
76  return CallMethodWithResult("TryConvert", binder, NoArgs, (DynamicMetaObject e) => binder.FallbackConvert(this, e));
77  }
78  return base.BindConvert(binder);
79  }
80 
81  public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
82  {
83  Fallback fallback = (DynamicMetaObject e) => binder.FallbackInvokeMember(this, args, e);
84  DynamicMetaObject errorSuggestion = BuildCallMethodWithResult("TryInvokeMember", binder, DynamicMetaObject.GetExpressions(args), BuildCallMethodWithResult("TryGetMember", new GetBinderAdapter(binder), NoArgs, fallback(null), (DynamicMetaObject e) => binder.FallbackInvoke(e, args, null)), null);
85  return fallback(errorSuggestion);
86  }
87 
88  public override DynamicMetaObject BindCreateInstance(CreateInstanceBinder binder, DynamicMetaObject[] args)
89  {
90  if (IsOverridden("TryCreateInstance"))
91  {
92  return CallMethodWithResult("TryCreateInstance", binder, DynamicMetaObject.GetExpressions(args), (DynamicMetaObject e) => binder.FallbackCreateInstance(this, args, e));
93  }
94  return base.BindCreateInstance(binder, args);
95  }
96 
97  public override DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args)
98  {
99  if (IsOverridden("TryInvoke"))
100  {
101  return CallMethodWithResult("TryInvoke", binder, DynamicMetaObject.GetExpressions(args), (DynamicMetaObject e) => binder.FallbackInvoke(this, args, e));
102  }
103  return base.BindInvoke(binder, args);
104  }
105 
106  public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
107  {
108  if (IsOverridden("TryBinaryOperation"))
109  {
110  return CallMethodWithResult("TryBinaryOperation", binder, DynamicMetaObject.GetExpressions(new DynamicMetaObject[1]
111  {
112  arg
113  }), (DynamicMetaObject e) => binder.FallbackBinaryOperation(this, arg, e));
114  }
115  return base.BindBinaryOperation(binder, arg);
116  }
117 
118  public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder)
119  {
120  if (IsOverridden("TryUnaryOperation"))
121  {
122  return CallMethodWithResult("TryUnaryOperation", binder, NoArgs, (DynamicMetaObject e) => binder.FallbackUnaryOperation(this, e));
123  }
124  return base.BindUnaryOperation(binder);
125  }
126 
127  public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
128  {
129  if (IsOverridden("TryGetIndex"))
130  {
131  return CallMethodWithResult("TryGetIndex", binder, DynamicMetaObject.GetExpressions(indexes), (DynamicMetaObject e) => binder.FallbackGetIndex(this, indexes, e));
132  }
133  return base.BindGetIndex(binder, indexes);
134  }
135 
136  public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value)
137  {
138  if (IsOverridden("TrySetIndex"))
139  {
140  return CallMethodReturnLast("TrySetIndex", binder, DynamicMetaObject.GetExpressions(indexes), value.Expression, (DynamicMetaObject e) => binder.FallbackSetIndex(this, indexes, value, e));
141  }
142  return base.BindSetIndex(binder, indexes, value);
143  }
144 
145  public override DynamicMetaObject BindDeleteIndex(DeleteIndexBinder binder, DynamicMetaObject[] indexes)
146  {
147  if (IsOverridden("TryDeleteIndex"))
148  {
149  return CallMethodNoResult("TryDeleteIndex", binder, DynamicMetaObject.GetExpressions(indexes), (DynamicMetaObject e) => binder.FallbackDeleteIndex(this, indexes, e));
150  }
151  return base.BindDeleteIndex(binder, indexes);
152  }
153 
154  private static Expression[] GetConvertedArgs(params Expression[] args)
155  {
156  ReadOnlyCollectionBuilder<Expression> readOnlyCollectionBuilder = new ReadOnlyCollectionBuilder<Expression>(args.Length);
157  for (int i = 0; i < args.Length; i++)
158  {
159  readOnlyCollectionBuilder.Add(Expression.Convert(args[i], typeof(object)));
160  }
161  return readOnlyCollectionBuilder.ToArray();
162  }
163 
164  private static Expression ReferenceArgAssign(Expression callArgs, Expression[] args)
165  {
166  ReadOnlyCollectionBuilder<Expression> readOnlyCollectionBuilder = null;
167  for (int i = 0; i < args.Length; i++)
168  {
169  ContractUtils.Requires(args[i] is ParameterExpression);
170  if (((ParameterExpression)args[i]).IsByRef)
171  {
172  if (readOnlyCollectionBuilder == null)
173  {
174  readOnlyCollectionBuilder = new ReadOnlyCollectionBuilder<Expression>();
175  }
176  readOnlyCollectionBuilder.Add(Expression.Assign(args[i], Expression.Convert(Expression.ArrayIndex(callArgs, Expression.Constant(i)), args[i].Type)));
177  }
178  }
179  if (readOnlyCollectionBuilder != null)
180  {
181  return Expression.Block(readOnlyCollectionBuilder);
182  }
183  return Expression.Empty();
184  }
185 
186  private static Expression[] BuildCallArgs(DynamicMetaObjectBinder binder, Expression[] parameters, Expression arg0, Expression arg1)
187  {
188  if (parameters != NoArgs)
189  {
190  if (arg1 != null)
191  {
192  return new Expression[3]
193  {
194  Constant(binder),
195  arg0,
196  arg1
197  };
198  }
199  return new Expression[2]
200  {
201  Constant(binder),
202  arg0
203  };
204  }
205  if (arg1 != null)
206  {
207  return new Expression[2]
208  {
209  Constant(binder),
210  arg1
211  };
212  }
213  return new Expression[1]
214  {
215  Constant(binder)
216  };
217  }
218 
220  {
221  Type type = binder.GetType();
222  while (!type.IsVisible)
223  {
224  type = type.BaseType;
225  }
226  return Expression.Constant(binder, type);
227  }
228 
229  private DynamicMetaObject CallMethodWithResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback)
230  {
231  return CallMethodWithResult(methodName, binder, args, fallback, null);
232  }
233 
234  private DynamicMetaObject CallMethodWithResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback, Fallback fallbackInvoke)
235  {
236  DynamicMetaObject fallbackResult = fallback(null);
237  DynamicMetaObject errorSuggestion = BuildCallMethodWithResult(methodName, binder, args, fallbackResult, fallbackInvoke);
238  return fallback(errorSuggestion);
239  }
240 
241  private DynamicMetaObject BuildCallMethodWithResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, DynamicMetaObject fallbackResult, Fallback fallbackInvoke)
242  {
243  if (!IsOverridden(methodName))
244  {
245  return fallbackResult;
246  }
247  ParameterExpression parameterExpression = Expression.Parameter(typeof(object), null);
248  ParameterExpression parameterExpression2 = (methodName != "TryBinaryOperation") ? Expression.Parameter(typeof(object[]), null) : Expression.Parameter(typeof(object), null);
249  Expression[] convertedArgs = GetConvertedArgs(args);
250  DynamicMetaObject dynamicMetaObject = new DynamicMetaObject(parameterExpression, BindingRestrictions.Empty);
251  if (binder.ReturnType != typeof(object))
252  {
253  UnaryExpression ifTrue = Expression.Convert(dynamicMetaObject.Expression, binder.ReturnType);
254  string value = Strings.DynamicObjectResultNotAssignable("{0}", Value.GetType(), binder.GetType(), binder.ReturnType);
255  Expression test = (!binder.ReturnType.IsValueType || !(Nullable.GetUnderlyingType(binder.ReturnType) == null)) ? ((Expression)Expression.OrElse(Expression.Equal(dynamicMetaObject.Expression, Expression.Constant(null)), Expression.TypeIs(dynamicMetaObject.Expression, binder.ReturnType))) : ((Expression)Expression.TypeIs(dynamicMetaObject.Expression, binder.ReturnType));
256  ConditionalExpression expression = Expression.Condition(test, ifTrue, Expression.Throw(Expression.New(typeof(InvalidCastException).GetConstructor(new Type[1]
257  {
258  typeof(string)
259  }), Expression.Call(typeof(string).GetMethod("Format", new Type[2]
260  {
261  typeof(string),
262  typeof(object[])
263  }), Expression.Constant(value), Expression.NewArrayInit(typeof(object), Expression.Condition(Expression.Equal(dynamicMetaObject.Expression, Expression.Constant(null)), Expression.Constant("null"), Expression.Call(dynamicMetaObject.Expression, typeof(object).GetMethod("GetType")), typeof(object))))), binder.ReturnType), binder.ReturnType);
264  dynamicMetaObject = new DynamicMetaObject(expression, dynamicMetaObject.Restrictions);
265  }
266  if (fallbackInvoke != null)
267  {
268  dynamicMetaObject = fallbackInvoke(dynamicMetaObject);
269  }
270  return new DynamicMetaObject(Expression.Block(new ParameterExpression[2]
271  {
272  parameterExpression,
273  parameterExpression2
274  }, (methodName != "TryBinaryOperation") ? Expression.Assign(parameterExpression2, Expression.NewArrayInit(typeof(object), convertedArgs)) : Expression.Assign(parameterExpression2, convertedArgs[0]), Expression.Condition(Expression.Call(GetLimitedSelf(), typeof(DynamicObject).GetMethod(methodName), BuildCallArgs(binder, args, parameterExpression2, parameterExpression)), Expression.Block((methodName != "TryBinaryOperation") ? ReferenceArgAssign(parameterExpression2, args) : Expression.Empty(), dynamicMetaObject.Expression), fallbackResult.Expression, binder.ReturnType)), GetRestrictions().Merge(dynamicMetaObject.Restrictions).Merge(fallbackResult.Restrictions));
275  }
276 
277  private DynamicMetaObject CallMethodReturnLast(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Expression value, Fallback fallback)
278  {
279  DynamicMetaObject dynamicMetaObject = fallback(null);
280  ParameterExpression parameterExpression = Expression.Parameter(typeof(object), null);
281  ParameterExpression parameterExpression2 = Expression.Parameter(typeof(object[]), null);
282  Expression[] convertedArgs = GetConvertedArgs(args);
283  DynamicMetaObject errorSuggestion = new DynamicMetaObject(Expression.Block(new ParameterExpression[2]
284  {
285  parameterExpression,
286  parameterExpression2
287  }, Expression.Assign(parameterExpression2, Expression.NewArrayInit(typeof(object), convertedArgs)), Expression.Condition(Expression.Call(GetLimitedSelf(), typeof(DynamicObject).GetMethod(methodName), BuildCallArgs(binder, args, parameterExpression2, Expression.Assign(parameterExpression, Expression.Convert(value, typeof(object))))), Expression.Block(ReferenceArgAssign(parameterExpression2, args), parameterExpression), dynamicMetaObject.Expression, typeof(object))), GetRestrictions().Merge(dynamicMetaObject.Restrictions));
288  return fallback(errorSuggestion);
289  }
290 
291  private DynamicMetaObject CallMethodNoResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback)
292  {
293  DynamicMetaObject dynamicMetaObject = fallback(null);
294  ParameterExpression parameterExpression = Expression.Parameter(typeof(object[]), null);
295  Expression[] convertedArgs = GetConvertedArgs(args);
296  DynamicMetaObject errorSuggestion = new DynamicMetaObject(Expression.Block(new ParameterExpression[1]
297  {
298  parameterExpression
299  }, Expression.Assign(parameterExpression, Expression.NewArrayInit(typeof(object), convertedArgs)), Expression.Condition(Expression.Call(GetLimitedSelf(), typeof(DynamicObject).GetMethod(methodName), BuildCallArgs(binder, args, parameterExpression, null)), Expression.Block(ReferenceArgAssign(parameterExpression, args), Expression.Empty()), dynamicMetaObject.Expression, typeof(void))), GetRestrictions().Merge(dynamicMetaObject.Restrictions));
300  return fallback(errorSuggestion);
301  }
302 
303  private bool IsOverridden(string method)
304  {
305  MemberInfo[] member = Value.GetType().GetMember(method, MemberTypes.Method, BindingFlags.Instance | BindingFlags.Public);
306  MemberInfo[] array = member;
307  for (int i = 0; i < array.Length; i++)
308  {
309  MethodInfo methodInfo = (MethodInfo)array[i];
310  if (methodInfo.DeclaringType != typeof(DynamicObject) && methodInfo.GetBaseDefinition().DeclaringType == typeof(DynamicObject))
311  {
312  return true;
313  }
314  }
315  return false;
316  }
317 
318  private BindingRestrictions GetRestrictions()
319  {
321  }
322 
323  private Expression GetLimitedSelf()
324  {
325  if (TypeUtils.AreEquivalent(base.Expression.Type, typeof(DynamicObject)))
326  {
327  return base.Expression;
328  }
329  return Expression.Convert(base.Expression, typeof(DynamicObject));
330  }
331  }
332 
334  [global::__DynamicallyInvokable]
335  protected DynamicObject()
336  {
337  }
338 
344  [global::__DynamicallyInvokable]
345  public virtual bool TryGetMember(GetMemberBinder binder, out object result)
346  {
347  result = null;
348  return false;
349  }
350 
356  [global::__DynamicallyInvokable]
357  public virtual bool TrySetMember(SetMemberBinder binder, object value)
358  {
359  return false;
360  }
361 
366  [global::__DynamicallyInvokable]
367  public virtual bool TryDeleteMember(DeleteMemberBinder binder)
368  {
369  return false;
370  }
371 
378  [global::__DynamicallyInvokable]
379  public virtual bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
380  {
381  result = null;
382  return false;
383  }
384 
390  [global::__DynamicallyInvokable]
391  public virtual bool TryConvert(ConvertBinder binder, out object result)
392  {
393  result = null;
394  return false;
395  }
396 
403  [global::__DynamicallyInvokable]
404  public virtual bool TryCreateInstance(CreateInstanceBinder binder, object[] args, out object result)
405  {
406  result = null;
407  return false;
408  }
409 
416  [global::__DynamicallyInvokable]
417  public virtual bool TryInvoke(InvokeBinder binder, object[] args, out object result)
418  {
419  result = null;
420  return false;
421  }
422 
429  [global::__DynamicallyInvokable]
430  public virtual bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result)
431  {
432  result = null;
433  return false;
434  }
435 
441  [global::__DynamicallyInvokable]
442  public virtual bool TryUnaryOperation(UnaryOperationBinder binder, out object result)
443  {
444  result = null;
445  return false;
446  }
447 
454  [global::__DynamicallyInvokable]
455  public virtual bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
456  {
457  result = null;
458  return false;
459  }
460 
467  [global::__DynamicallyInvokable]
468  public virtual bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)
469  {
470  return false;
471  }
472 
478  [global::__DynamicallyInvokable]
479  public virtual bool TryDeleteIndex(DeleteIndexBinder binder, object[] indexes)
480  {
481  return false;
482  }
483 
486  [global::__DynamicallyInvokable]
488  {
489  return new string[0];
490  }
491 
495  [global::__DynamicallyInvokable]
496  public virtual DynamicMetaObject GetMetaObject(Expression parameter)
497  {
498  return new MetaDynamic(parameter, this);
499  }
500  }
501 }
Obtains information about the attributes of a member and provides access to member metadata.
Definition: MemberInfo.cs:14
Represents an expression that has a constant value.
Represents the dynamic create operation at the call site, providing the binding semantic and the deta...
abstract Type BaseType
Gets the type from which the current T:System.Type directly inherits.
Definition: Type.cs:180
abstract DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)
When overridden in the derived class, performs the binding of the dynamic invoke operation if the tar...
Represents the dynamic set index operation at the call site, providing the binding semantic and the d...
Represents a dynamic object, that can have its operations bound at runtime.
bool IsVisible
Gets a value indicating whether the T:System.Type can be accessed by code outside the assembly.
Definition: Type.cs:240
DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value)
Performs the binding of the dynamic set member operation if the target dynamic object cannot bind.
abstract MethodInfo GetBaseDefinition()
When overridden in a derived class, returns the T:System.Reflection.MethodInfo object for the method ...
virtual DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args)
Performs the binding of the dynamic invoke operation.
virtual DynamicMetaObject BindDeleteMember(DeleteMemberBinder binder)
Performs the binding of the dynamic delete member operation.
Represents the convert dynamic operation at the call site, providing the binding semantic and the det...
Definition: ConvertBinder.cs:7
Discovers the attributes of a method and provides access to method metadata.
Definition: MethodInfo.cs:13
virtual bool TryDeleteIndex(DeleteIndexBinder binder, object[] indexes)
Provides the implementation for operations that delete an object by index. This method is not intende...
Represents the dynamic get member operation at the call site, providing the binding semantic and the ...
Represents the dynamic binding and a binding logic of an object participating in the dynamic binding.
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
Definition: BindingFlags.cs:10
Represents the dynamic set member operation at the call site, providing the binding semantic and the ...
DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args)
Performs the binding of the dynamic invoke operation if the target dynamic object cannot bind.
Definition: InvokeBinder.cs:51
Definition: __Canon.cs:3
The exception that is thrown for invalid casting or explicit conversion.
DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject target, DynamicMetaObject arg)
Performs the binding of the binary dynamic operation if the target dynamic object cannot bind.
static BindingRestrictions GetTypeRestriction(Expression expression, Type type)
Creates the binding restriction that check the expression for runtime type identity.
Represents a value type that can be assigned null.
Definition: Nullable.cs:12
Provides a base class for specifying dynamic behavior at run time. This class must be inherited from;...
DynamicMetaObject FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args)
Performs the binding of the dynamic invoke member operation if the target dynamic object cannot bind.
virtual DynamicMetaObject BindCreateInstance(CreateInstanceBinder binder, DynamicMetaObject[] args)
Performs the binding of the dynamic create instance operation.
Represents the invoke dynamic operation at the call site, providing the binding semantic and the deta...
Definition: InvokeBinder.cs:7
static readonly BindingRestrictions Empty
Represents an empty set of binding restrictions. This field is read only.
virtual bool TryInvoke(InvokeBinder binder, object[] args, out object result)
Provides the implementation for operations that invoke an object. Classes derived from the T:System....
DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target)
Performs the binding of the unary dynamic operation if the target dynamic object cannot bind.
Expression Expression
The expression representing the T:System.Dynamic.DynamicMetaObject during the dynamic binding process...
virtual bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
Provides the implementation for operations that invoke a member. Classes derived from the T:System....
DynamicMetaObject FallbackSetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject value)
Performs the binding of the dynamic set index operation if the target dynamic object cannot bind.
static Type GetUnderlyingType(Type nullableType)
Returns the underlying type argument of the specified nullable type.
Definition: Nullable.cs:212
virtual bool TryDeleteMember(DeleteMemberBinder binder)
Provides the implementation for operations that delete an object member. This method is not intended ...
DynamicMetaObject FallbackGetMember(DynamicMetaObject target)
Performs the binding of the dynamic get member operation if the target dynamic object cannot bind.
DynamicMetaObject FallbackDeleteMember(DynamicMetaObject target)
Performs the binding of the dynamic delete member operation if the target dynamic object cannot bind.
virtual DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
Performs the binding of the dynamic binary operation.
DynamicMetaObject FallbackConvert(DynamicMetaObject target)
Performs the binding of the dynamic convert operation if the target dynamic object cannot bind.
Provides the base class from which the classes that represent expression tree nodes are derived....
Definition: Expression.cs:17
virtual bool TryUnaryOperation(UnaryOperationBinder binder, out object result)
Provides implementation for unary operations. Classes derived from the T:System.Dynamic....
virtual DynamicMetaObject BindConvert(ConvertBinder binder)
Performs the binding of the dynamic conversion operation.
virtual DynamicMetaObject BindGetMember(GetMemberBinder binder)
Performs the binding of the dynamic get member operation.
string Name
Gets the name of the member to invoke.
virtual bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
Provides the implementation for operations that get a value by index. Classes derived from the T:Syst...
virtual bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result)
Provides implementation for binary operations. Classes derived from the T:System.Dynamic....
virtual bool TryConvert(ConvertBinder binder, out object result)
Provides implementation for type conversion operations. Classes derived from the T:System....
BindingRestrictions Restrictions
The set of binding restrictions under which the binding is valid.
Represents the invoke member dynamic operation at the call site, providing the binding semantic and t...
virtual DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
Performs the binding of the dynamic get index operation.
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
The dynamic call site binder that participates in the T:System.Dynamic.DynamicMetaObject binding prot...
Type DeclaringType
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
Definition: _MethodInfo.cs:31
DynamicMetaObject FallbackCreateInstance(DynamicMetaObject target, DynamicMetaObject[] args)
Performs the binding of the dynamic create operation if the target dynamic object cannot bind.
DynamicMetaObject FallbackDeleteIndex(DynamicMetaObject target, DynamicMetaObject[] indexes)
Performs the binding of the dynamic delete index operation if the target dynamic object cannot bind.
Represents a named parameter expression.
bool IsValueType
Gets a value indicating whether the T:System.Type is a value type.
Definition: Type.cs:445
virtual DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value)
Performs the binding of the dynamic set member operation.
virtual IEnumerable< string > GetDynamicMemberNames()
Returns the enumeration of all dynamic member names.
void Add(T item)
Adds an item to the T:System.Runtime.CompilerServices.ReadOnlyCollectionBuilder`1.
Represents a set of binding restrictions on the T:System.Dynamic.DynamicMetaObject under which the dy...
DynamicMetaObject FallbackGetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes)
Performs the binding of the dynamic get index operation if the target dynamic object cannot bind.
virtual bool TryGetMember(GetMemberBinder binder, out object result)
Provides the implementation for operations that get member values. Classes derived from the T:System....
Represents the dynamic get index operation at the call site, providing the binding semantic and the d...
virtual bool TrySetMember(SetMemberBinder binder, object value)
Provides the implementation for operations that set member values. Classes derived from the T:System....
virtual DynamicMetaObject GetMetaObject(Expression parameter)
Provides a T:System.Dynamic.DynamicMetaObject that dispatches to the dynamic virtual methods....
Represents the dynamic delete index operation at the call site, providing the binding semantic and th...
virtual bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)
Provides the implementation for operations that set a value by index. Classes derived from the T:Syst...
T [] ToArray()
Copies the elements of the T:System.Runtime.CompilerServices.ReadOnlyCollectionBuilder`1 to a new arr...
virtual DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value)
Performs the binding of the dynamic set index operation.
Represents the binary dynamic operation at the call site, providing the binding semantic and the deta...
Represents an expression that has a unary operator.
Specifies that the class can be serialized.
Represents the unary dynamic operation at the call site, providing the binding semantic and the detai...
virtual DynamicMetaObject BindDeleteIndex(DeleteIndexBinder binder, DynamicMetaObject[] indexes)
Performs the binding of the dynamic delete index operation.
Represents an expression that has a conditional operator.
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
virtual DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder)
Performs the binding of the dynamic unary operation.
MemberTypes
Marks each type of member that is defined as a derived class of T:System.Reflection....
Definition: MemberTypes.cs:9
bool IgnoreCase
Gets the value indicating if the string comparison should ignore the case of the member name.
DynamicObject()
Enables derived types to initialize a new instance of the T:System.Dynamic.DynamicObject type.
Represents the dynamic delete member operation at the call site, providing the binding semantic and t...
virtual bool TryCreateInstance(CreateInstanceBinder binder, object[] args, out object result)
Provides the implementation for operations that initialize a new instance of a dynamic object....
virtual Type ReturnType
The result type of the operation.