Table of Contents

Class CacheableInvocation

Namespace
Dynamitey
Assembly
Dynamitey.Community.dll

Cacheable representation of an invocation without the target or arguments. By default only public members are bound, which makes the CallSite easier to reuse. Accessibility and static context are taken from the constructor context argument and are not updated if Invoke(object, params object?[]?) is later passed an InvokeContext; that wrapper is unwrapped to its Target only.

public class CacheableInvocation : Invocation
Inheritance
CacheableInvocation
Inherited Members

Constructors

CacheableInvocation(InvocationKind, String_OR_InvokeMemberName?, int, string?[]?, object?, Type?, bool, object?[]?)

Initializes a new instance of the CacheableInvocation class.

public CacheableInvocation(InvocationKind kind, String_OR_InvokeMemberName? name = null, int argCount = 0, string?[]? argNames = null, object? context = null, Type? convertType = null, bool convertExplicit = false, object?[]? storedArgs = null)

Parameters

kind InvocationKind

The kind.

name String_OR_InvokeMemberName

The name.

argCount int

Expected argument count. When omitted (0), inferred from storedArgs or argNames. Must match storedArgs length when both are supplied.

argNames string[]

The arg names.

context object

The context.

convertType Type

Type of the convert.

convertExplicit bool

true to use an explicit conversion, false for an implicit one.

storedArgs object[]

Arguments for InvokeWithStoredArgs(object). Their length is the argument count when argCount is omitted.

Methods

CreateCall(InvocationKind, String_OR_InvokeMemberName?, CallInfo?, object?)

Creates the cacheable method or indexer or property call.

public static CacheableInvocation CreateCall(InvocationKind kind, String_OR_InvokeMemberName? name = null, CallInfo? callInfo = null, object? context = null)

Parameters

kind InvocationKind

The kind.

name String_OR_InvokeMemberName

The name.

callInfo CallInfo

The callInfo.

context object

The context.

Returns

CacheableInvocation

CreateConvert(Type, bool)

Creates the cacheable convert call.

public static CacheableInvocation CreateConvert(Type convertType, bool convertExplicit = false)

Parameters

convertType Type

Type of the convert.

convertExplicit bool

if set to true [convert explicit].

Returns

CacheableInvocation

Equals(CacheableInvocation?)

Determines whether the specified invocation is equal to this instance.

public bool Equals(CacheableInvocation? other)

Parameters

other CacheableInvocation

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.

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.

Invoke(object, params object?[]?)

Invokes the invocation on specified target with specific args.

[RequiresUnreferencedCode("Builds/reuses a cached DLR CallSite per Kind via InvokeHelper, which resolves a member via the DLR binder; trimming can remove the member being resolved.")]
[RequiresDynamicCode("Every Kind binds through the DLR (directly or via InvokeHelper's cached CallSite), which requires runtime code generation; not supported when AOT-compiled.")]
public override object? Invoke(object target, params object?[]? args)

Parameters

target object

The target.

args object[]

The args.

Returns

object

Exceptions

ArgumentException

CacheableInvocation can't change conversion type on invoke.;args

InvalidOperationException

Unknown Invocation Kind: