Table of Contents

Class BaseForwarder

Namespace
Dynamitey.DynamicObjects
Assembly
Dynamitey.Community.dll

Proxies Calls allows subclasser to override do extra actions before or after base invocation

public abstract class BaseForwarder : BaseObject, IDynamicMetaObjectProvider, IEquivalentType, IForwarder
Inheritance
BaseForwarder
Implements
Derived
Inherited Members

Remarks

This may not be as efficient as other proxies that can work on just static objects or just dynamic objects... Consider this when using.

Constructors

BaseForwarder(object?)

Initializes a new instance of the BaseForwarder class.

[RequiresDynamicCode("Constructing any BaseForwarder-derived type instantiates System.Dynamic.DynamicObject, whose default constructor requires the DLR's runtime code generation; not supported when AOT-compiled.")]
protected BaseForwarder(object? target)

Parameters

target object

The target.

Properties

CallTarget

Gets the call target.

protected virtual object? CallTarget { get; }

Property Value

object

The call target.

Target

Gets or sets the target.

protected object? Target { get; set; }

Property Value

object

The target.

Methods

Equals(BaseForwarder?)

Equals the specified other.

public bool Equals(BaseForwarder? other)

Parameters

other BaseForwarder

The other.

Returns

bool

Equals(object?)

Determines whether the specified object is equal to this instance.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

GetDynamicMemberNames()

Returns the enumeration of all dynamic member names.

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.GetMemberNames. This is a DynamicObject.GetDynamicMemberNames override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic member enumeration already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.GetMemberNames calls as above; see the IL2026 suppression on this member.")]
public override IEnumerable<string> GetDynamicMemberNames()

Returns

IEnumerable<string>

A sequence that contains dynamic member names.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

TryGetIndex(GetIndexBinder, object?[]?, out object)

Tries the index of the get.

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.InvokeGetIndex. This is a DynamicObject.TryGetIndex override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic indexer access already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.InvokeGetIndex call as above; see the IL2026 suppression on this member.")]
public override bool TryGetIndex(GetIndexBinder binder, object?[]? indexes, out object result)

Parameters

binder GetIndexBinder

The binder.

indexes object[]

The indexes.

result object

The result.

Returns

bool

TryGetMember(GetMemberBinder, out object?)

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

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.InvokeIsEvent/InvokeGet. This is a DynamicObject.TryGetMember override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic member access already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.InvokeIsEvent/InvokeGet calls as above; see the IL2026 suppression on this member.")]
public override bool TryGetMember(GetMemberBinder binder, out object? result)

Parameters

binder GetMemberBinder

Provides 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 DynamicObject class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.

result object

The result of the get operation. For example, if the method is called for a property, you can assign the property value to result.

Returns

bool

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.)

TryInvoke(InvokeBinder, object?[]?, out object?)

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

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.Invoke/InvokeAction. This is a DynamicObject.TryInvoke override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic call site already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.Invoke/InvokeAction calls as above; see the IL2026 suppression on this member.")]
public override bool TryInvoke(InvokeBinder binder, object?[]? args, out object? result)

Parameters

binder InvokeBinder

Provides information about the invoke operation.

args object[]

The arguments that are passed to the object during the invoke operation. For example, for the sampleObject(100) operation, where sampleObject is derived from the DynamicObject class, args[0] is equal to 100.

result object

The result of the object invocation.

Returns

bool

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.

TryInvokeMember(InvokeMemberBinder, object?[]?, out object?)

Tries the invoke member.

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.InvokeGet (to read the binder's own generic-arguments property by name) and Dynamic.InvokeMember/InvokeMemberAction. This is a DynamicObject.TryInvokeMember override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic call site already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.InvokeGet/InvokeMember/InvokeMemberAction calls as above; see the IL2026 suppression on this member.")]
public override bool TryInvokeMember(InvokeMemberBinder binder, object?[]? args, out object? result)

Parameters

binder InvokeMemberBinder

The binder.

args object[]

The args.

result object

The result.

Returns

bool

TrySetIndex(SetIndexBinder, object?[]?, object?)

Tries the index of the set.

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.InvokeSetIndex. This is a DynamicObject.TrySetIndex override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic indexer assignment already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.InvokeSetIndex call as above; see the IL2026 suppression on this member.")]
public override bool TrySetIndex(SetIndexBinder binder, object?[]? indexes, object? value)

Parameters

binder SetIndexBinder

The binder.

indexes object[]

The indexes.

value object

The value.

Returns

bool

TrySetMember(SetMemberBinder, object?)

Tries the set member.

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.InvokeIsEvent/InvokeAddAssignMember/InvokeSubtractAssignMember/InvokeSet. This is a DynamicObject.TrySetMember override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic member assignment already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.* calls as above; see the IL2026 suppression on this member.")]
public override bool TrySetMember(SetMemberBinder binder, object? value)

Parameters

binder SetMemberBinder

The binder.

value object

The value.

Returns

bool