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
kindInvocationKindThe kind.
nameString_OR_InvokeMemberNameThe name.
argCountintExpected argument count. When omitted (0), inferred from
storedArgsorargNames. Must matchstoredArgslength when both are supplied.argNamesstring[]The arg names.
contextobjectThe context.
convertTypeTypeType of the convert.
convertExplicitbooltrueto use an explicit conversion,falsefor an implicit one.storedArgsobject[]Arguments for InvokeWithStoredArgs(object). Their length is the argument count when
argCountis 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
kindInvocationKindThe kind.
nameString_OR_InvokeMemberNameThe name.
callInfoCallInfoThe callInfo.
contextobjectThe context.
Returns
CreateConvert(Type, bool)
Creates the cacheable convert call.
public static CacheableInvocation CreateConvert(Type convertType, bool convertExplicit = false)
Parameters
Returns
Equals(CacheableInvocation?)
Determines whether the specified invocation is equal to this instance.
public bool Equals(CacheableInvocation? other)
Parameters
otherCacheableInvocationThe other.
Returns
Equals(object?)
Determines whether the specified object is equal to this instance.
public override bool Equals(object? obj)
Parameters
Returns
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
Returns
Exceptions
- ArgumentException
CacheableInvocation can't change conversion type on invoke.;args
- InvalidOperationException
Unknown Invocation Kind: