mscorlib(4.0.0.0) API with additions
System.Dynamic.DynamicObject Class Reference

Provides a base class for specifying dynamic behavior at run time. This class must be inherited from; you cannot instantiate it directly. More...

Inheritance diagram for System.Dynamic.DynamicObject:
[legend]
Collaboration diagram for System.Dynamic.DynamicObject:
[legend]

Public Member Functions

virtual bool TryGetMember (GetMemberBinder binder, out object result)
 Provides the implementation for operations that get member values. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as getting a value for a property. More...
 
virtual bool TrySetMember (SetMemberBinder binder, object value)
 Provides the implementation for operations that set member values. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as setting a value for a property. More...
 
virtual bool TryDeleteMember (DeleteMemberBinder binder)
 Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. More...
 
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.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as calling a method. More...
 
virtual bool TryConvert (ConvertBinder binder, out object result)
 Provides implementation for type conversion operations. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations that convert an object from one type to another. More...
 
virtual bool TryCreateInstance (CreateInstanceBinder binder, object[] args, out object result)
 Provides the implementation for operations that initialize a new instance of a dynamic object. This method is not intended for use in C# or Visual Basic. More...
 
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.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate. More...
 
virtual bool TryBinaryOperation (BinaryOperationBinder binder, object arg, out object result)
 Provides implementation for binary operations. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as addition and multiplication. More...
 
virtual bool TryUnaryOperation (UnaryOperationBinder binder, out object result)
 Provides implementation for unary operations. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as negation, increment, or decrement. More...
 
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:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for indexing operations. More...
 
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:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations that access objects by a specified index. More...
 
virtual bool TryDeleteIndex (DeleteIndexBinder binder, object[] indexes)
 Provides the implementation for operations that delete an object by index. This method is not intended for use in C# or Visual Basic. More...
 
virtual IEnumerable< string > GetDynamicMemberNames ()
 Returns the enumeration of all dynamic member names. More...
 
virtual DynamicMetaObject GetMetaObject (Expression parameter)
 Provides a T:System.Dynamic.DynamicMetaObject that dispatches to the dynamic virtual methods. The object can be encapsulated inside another T:System.Dynamic.DynamicMetaObject to provide custom behavior for individual actions. This method supports the Dynamic Language Runtime infrastructure for language implementers and it is not intended to be used directly from your code. More...
 

Protected Member Functions

 DynamicObject ()
 Enables derived types to initialize a new instance of the T:System.Dynamic.DynamicObject type. More...
 

Detailed Description

Provides a base class for specifying dynamic behavior at run time. This class must be inherited from; you cannot instantiate it directly.

Definition at line 12 of file DynamicObject.cs.

Constructor & Destructor Documentation

◆ DynamicObject()

System.Dynamic.DynamicObject.DynamicObject ( )
protected

Enables derived types to initialize a new instance of the T:System.Dynamic.DynamicObject type.

Definition at line 335 of file DynamicObject.cs.

Member Function Documentation

◆ GetDynamicMemberNames()

virtual IEnumerable<string> System.Dynamic.DynamicObject.GetDynamicMemberNames ( )
virtual

Returns the enumeration of all dynamic member names.

Returns
A sequence that contains dynamic member names.

Definition at line 487 of file DynamicObject.cs.

◆ GetMetaObject()

virtual DynamicMetaObject System.Dynamic.DynamicObject.GetMetaObject ( Expression  parameter)
virtual

Provides a T:System.Dynamic.DynamicMetaObject that dispatches to the dynamic virtual methods. The object can be encapsulated inside another T:System.Dynamic.DynamicMetaObject to provide custom behavior for individual actions. This method supports the Dynamic Language Runtime infrastructure for language implementers and it is not intended to be used directly from your code.

Parameters
parameterThe expression that represents T:System.Dynamic.DynamicMetaObject to dispatch to the dynamic virtual methods.
Returns
An object of the T:System.Dynamic.DynamicMetaObject type.

Implements System.Dynamic.IDynamicMetaObjectProvider.

Definition at line 496 of file DynamicObject.cs.

◆ TryBinaryOperation()

virtual bool System.Dynamic.DynamicObject.TryBinaryOperation ( BinaryOperationBinder  binder,
object  arg,
out object  result 
)
virtual

Provides implementation for binary operations. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as addition and multiplication.

Parameters
binderProvides information about the binary operation. The binder.Operation property returns an T:System.Linq.Expressions.ExpressionType object. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, binder.Operation returns ExpressionType.Add.
argThe right operand for the binary operation. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, arg is equal to second.
resultThe result of the binary operation.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 430 of file DynamicObject.cs.

◆ TryConvert()

virtual bool System.Dynamic.DynamicObject.TryConvert ( ConvertBinder  binder,
out object  result 
)
virtual

Provides implementation for type conversion operations. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations that convert an object from one type to another.

Parameters
binderProvides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the T:System.Dynamic.DynamicObject class, binder.Type returns the T:System.String type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion.
resultThe result of the type conversion operation.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 391 of file DynamicObject.cs.

◆ TryCreateInstance()

virtual bool System.Dynamic.DynamicObject.TryCreateInstance ( CreateInstanceBinder  binder,
object []  args,
out object  result 
)
virtual

Provides the implementation for operations that initialize a new instance of a dynamic object. This method is not intended for use in C# or Visual Basic.

Parameters
binderProvides information about the initialization operation.
argsThe arguments that are passed to the object during initialization. For example, for the new SampleType(100) operation, where SampleType is the type derived from the T:System.Dynamic.DynamicObject class, args[0] is equal to 100.
resultThe result of the initialization.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 404 of file DynamicObject.cs.

◆ TryDeleteIndex()

virtual bool System.Dynamic.DynamicObject.TryDeleteIndex ( DeleteIndexBinder  binder,
object []  indexes 
)
virtual

Provides the implementation for operations that delete an object by index. This method is not intended for use in C# or Visual Basic.

Parameters
binderProvides information about the deletion.
indexesThe indexes to be deleted.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 479 of file DynamicObject.cs.

◆ TryDeleteMember()

virtual bool System.Dynamic.DynamicObject.TryDeleteMember ( DeleteMemberBinder  binder)
virtual

Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic.

Parameters
binderProvides information about the deletion.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 367 of file DynamicObject.cs.

◆ TryGetIndex()

virtual bool System.Dynamic.DynamicObject.TryGetIndex ( GetIndexBinder  binder,
object []  indexes,
out object  result 
)
virtual

Provides the implementation for operations that get a value by index. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for indexing operations.

Parameters
binderProvides information about the operation.
indexesThe indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, indexes[0] is equal to 3.
resultThe result of the index operation.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)

Definition at line 455 of file DynamicObject.cs.

◆ TryGetMember()

virtual bool System.Dynamic.DynamicObject.TryGetMember ( GetMemberBinder  binder,
out object  result 
)
virtual

Provides the implementation for operations that get member values. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as getting a value for a property.

Parameters
binderProvides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the T:System.Dynamic.DynamicObject class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.
resultThe result of the get operation. For example, if the method is called for a property, you can assign the property value to result .
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)

Definition at line 345 of file DynamicObject.cs.

◆ TryInvoke()

virtual bool System.Dynamic.DynamicObject.TryInvoke ( InvokeBinder  binder,
object []  args,
out object  result 
)
virtual

Provides the implementation for operations that invoke an object. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate.

Parameters
binderProvides information about the invoke operation.
argsThe arguments that are passed to the object during the invoke operation. For example, for the sampleObject(100) operation, where sampleObject is derived from the T:System.Dynamic.DynamicObject class, args[0] is equal to 100.
resultThe result of the object invocation.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.

Definition at line 417 of file DynamicObject.cs.

◆ TryInvokeMember()

virtual bool System.Dynamic.DynamicObject.TryInvokeMember ( InvokeMemberBinder  binder,
object []  args,
out object  result 
)
virtual

Provides the implementation for operations that invoke a member. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as calling a method.

Parameters
binderProvides information about the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is an instance of the class derived from the T:System.Dynamic.DynamicObject class, binder.Name returns "SampleMethod". The binder.IgnoreCase property specifies whether the member name is case-sensitive.
argsThe arguments that are passed to the object member during the invoke operation. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is derived from the T:System.Dynamic.DynamicObject class, args[0] is equal to 100.
resultThe result of the member invocation.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 379 of file DynamicObject.cs.

◆ TrySetIndex()

virtual bool System.Dynamic.DynamicObject.TrySetIndex ( SetIndexBinder  binder,
object []  indexes,
object  value 
)
virtual

Provides the implementation for operations that set a value by index. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations that access objects by a specified index.

Parameters
binderProvides information about the operation.
indexesThe indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the T:System.Dynamic.DynamicObject class, indexes[0] is equal to 3.
valueThe value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the T:System.Dynamic.DynamicObject class, value is equal to 10.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.

Definition at line 468 of file DynamicObject.cs.

◆ TrySetMember()

virtual bool System.Dynamic.DynamicObject.TrySetMember ( SetMemberBinder  binder,
object  value 
)
virtual

Provides the implementation for operations that set member values. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as setting a value for a property.

Parameters
binderProvides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the T:System.Dynamic.DynamicObject class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.
valueThe value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the T:System.Dynamic.DynamicObject class, the value is "Test".
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 357 of file DynamicObject.cs.

◆ TryUnaryOperation()

virtual bool System.Dynamic.DynamicObject.TryUnaryOperation ( UnaryOperationBinder  binder,
out object  result 
)
virtual

Provides implementation for unary operations. Classes derived from the T:System.Dynamic.DynamicObject class can override this method to specify dynamic behavior for operations such as negation, increment, or decrement.

Parameters
binderProvides information about the unary operation. The binder.Operation property returns an T:System.Linq.Expressions.ExpressionType object. For example, for the negativeNumber = -number statement, where number is derived from the DynamicObject class, binder.Operation returns "Negate".
resultThe result of the unary operation.
Returns
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

Definition at line 442 of file DynamicObject.cs.


The documentation for this class was generated from the following file: