Table of Contents

Class Dynamic

Namespace
Dynamitey
Assembly
Dynamitey.Community.dll

Main API

public static class Dynamic
Inheritance
Dynamic
Inherited Members

Remarks

A deliberate note on this class's use of dynamic under nullable reference types: dynamic is object with a compiler flag, so annotating a dynamic parameter as dynamic? would say almost nothing - every member access on it is unchecked by the compiler regardless, dynamic dispatch happens at runtime either way. Parameters that feed the DLR directly (target, args, operator operands) are therefore left as plain, non-nullable object/dynamic - matching this library's actual behavior, since a null target already fails inside GetTargetContext(object, out Type, out bool) before any binder runs.

dynamic return values are different: they are whatever the resolved member itself produced, and a property or method can legitimately return null. Marking those dynamic? is not empty noise - it gives a real, actionable warning the first time a caller uses the result in a non-dynamic context (e.g. passes it to a non-nullable object parameter) before ever reaching a member access on it. So the methods below that hand back "whatever the target returned" (InvokeMember(object, String_OR_InvokeMemberName, params object?[]), Invoke(object, params object?[]), InvokeGet(object, string), InvokeConvert(object, Type, bool), etc.) are annotated dynamic?, while ones whose result is always a Dynamitey-constructed proxy (Curry(object, int?), InvokeSetAll) stay non-nullable dynamic.

Properties

InvokeSetAll

Call Like method invokes set on target and a list of property/value. Invoke with dictionary, anonymous type or named arguments.

public static dynamic InvokeSetAll { get; }

Property Value

dynamic

The invoke set all.

Methods

ApplyEquivalentType(IEquivalentType, params Type[])

Applies the equivalent type hint to dynamic object

[RequiresUnreferencedCode("For more than one type, converts each with ConvertEach<FauxType>, which resolves a conversion via the DLR binder per item; trimming can remove the conversion being resolved.")]
[RequiresDynamicCode("ConvertEach's DLR conversion path requires runtime code generation; not supported when AOT-compiled.")]
public static void ApplyEquivalentType(IEquivalentType target, params Type[] types)

Parameters

target IEquivalentType

The target.

types Type[]

The types.

AwaitResult(object?)

Awaits a Task (or Task<TResult>) obtained dynamically - typically the un-awaited result of InvokeMember(object, String_OR_InvokeMemberName, params object?[]), which may be the raw Task or an AwaitableResult wrapping one - reading its result through reflection instead of dynamic binding, so an inaccessible TResult does not trip the C# runtime binder.

[RequiresUnreferencedCode("Reads the completed task's 'Result' property via Type.GetProperty(nameof(Result)) reflection; trimming can remove that property from the task's concrete type.")]
public static Task<object?> AwaitResult(object? task)

Parameters

task object

The task to await, or an AwaitableResult wrapping one, or null.

Returns

Task<object>

The task's result, boxed to object (null for a non-generic Task, or if task itself is null).

Exceptions

InvalidOperationException

task is not a Task or an AwaitableResult.

ClearCaches()

Clears the dynamic binding caches.

public static void ClearCaches()

CoerceConvert(object?, Type)

Goes the extra mile to convert target to type.

[RequiresUnreferencedCode("Falls through CoerceToDelegate, a late-bound Impromptu.DynamicActLike call, InvokeConvert, and TypeDescriptor/TypeConverter reflection - each resolves a member or type by name; trimming can remove any of them.")]
[RequiresDynamicCode("The CoerceToDelegate and Impromptu.DynamicActLike paths require the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic? CoerceConvert(object? target, Type type)

Parameters

target object

The target.

type Type

The type.

Returns

dynamic

CoerceToDelegate(object?, Type)

Coerces any invokable object to the specified delegate type.

[RequiresUnreferencedCode("Falls back to Expression.Lambda(...).Compile() and, for a plain Action/Func-shaped delegate whose parameters are all reference types, to invoking invokeableObject through the DLR; trimming can remove the member the compiled expression or DLR call resolves.")]
[RequiresDynamicCode("Expression.Lambda(...).Compile() and the DLR invocation path both generate code at runtime; not supported when AOT-compiled.")]
public static dynamic? CoerceToDelegate(object? invokeableObject, Type delegateType)

Parameters

invokeableObject object

The object to coerce.

delegateType Type

Type of the delegate.

Returns

dynamic

ConvertAll<T>(IEnumerable, bool)

Implicit or Explicit Converts the items of the specified enumerable.

[Obsolete("Use ConvertEach.")]
[RequiresUnreferencedCode("Forwards to ConvertEach, which resolves a conversion via the DLR binder per item.")]
[RequiresDynamicCode("Forwards to ConvertEach, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static IEnumerable<T> ConvertAll<T>(this IEnumerable enumerable, bool explict = false)

Parameters

enumerable IEnumerable

The enumerable whose items are converted.

explict bool

true to use an explicit conversion, false for an implicit one. The parameter name is misspelled and is kept that way: it is declared public API, and renaming it would break callers passing it by name.

Returns

IEnumerable<T>

The converted items, converted lazily as the result is enumerated.

Type Parameters

T

The type each item is converted to.

ConvertEach<T>(IEnumerable, bool)

Implicit or Explicit Converts the items of the specified enumerable.

[RequiresUnreferencedCode("Calls InvokeConvert per item, which resolves a conversion via the DLR binder; trimming can remove the conversion being resolved.")]
[RequiresDynamicCode("InvokeConvert's DLR path requires runtime code generation; not supported when AOT-compiled.")]
public static IEnumerable<T> ConvertEach<T>(this IEnumerable enumerable, bool @explicit = false)

Parameters

enumerable IEnumerable

The enumerable.

explicit bool

if set to true [explicit].

Returns

IEnumerable<T>

Type Parameters

T

CreateCallSite(Type, CallSiteBinder, String_OR_InvokeMemberName, Type, string?[]?, bool, bool)

Creates a cached call site at runtime.

[RequiresUnreferencedCode("Builds a raw DLR CallSite from a caller-supplied binder; the binder resolves its target member by name at each call, and trimming can remove that member. Advanced/low-level API - prefer InvokeMember/InvokeGet/etc.")]
[RequiresDynamicCode("Creating a CallSite - and, for delegate shapes with more than 14 parameters, emitting the delegate type itself via Reflection.Emit - requires the DLR's runtime code generation and is not supported when AOT-compiled.")]
public static CallSite CreateCallSite(Type delegateType, CallSiteBinder binder, String_OR_InvokeMemberName name, Type context, string?[]? argNames = null, bool staticContext = false, bool isEvent = false)

Parameters

delegateType Type

Type of the delegate.

binder CallSiteBinder

The CallSite binder.

name String_OR_InvokeMemberName

Member Name

context Type

Permissions Context type

argNames string[]

The arg names.

staticContext bool

if set to true [static context].

isEvent bool

if set to true [is event].

Returns

CallSite

The CallSite

Remarks

Advanced usage only for serious custom dynamic invocation.

See Also

CreateCallSite<T>(CallSiteBinder, String_OR_InvokeMemberName, Type, string?[]?, bool, bool)

Creates the call site.

[RequiresUnreferencedCode("Builds a raw DLR CallSite from a caller-supplied binder; the binder resolves its target member by name at each call, and trimming can remove that member. Advanced/low-level API - prefer InvokeMember/InvokeGet/etc.")]
[RequiresDynamicCode("Creating a CallSite<T> requires the DLR's runtime code generation to produce the binding rule; not supported when AOT-compiled.")]
public static CallSite<T> CreateCallSite<T>(CallSiteBinder binder, String_OR_InvokeMemberName name, Type context, string?[]? argNames = null, bool staticContext = false, bool isEvent = false) where T : class

Parameters

binder CallSiteBinder

The binder.

name String_OR_InvokeMemberName

The name.

context Type

The context.

argNames string[]

The arg names.

staticContext bool

if set to true [static context].

isEvent bool

if set to true [is event].

Returns

CallSite<T>

Type Parameters

T

Examples

Unit test that exhibits usage

string tResult = String.Empty;
var tPoco = new MethOutPoco();
var tBinder =
Binder.InvokeMember(BinderFlags.None, "Func", null, GetType(),
new[]
{
Info.Create(
InfoFlags.None, null),
Info.Create(
InfoFlags.IsOut |
InfoFlags.UseCompileTimeType, null)
});
var tSite = Impromptu.CreateCallSite<DynamicTryString>(tBinder);
tSite.Target.Invoke(tSite, tPoco, out tResult);
Assert.AreEqual("success", tResult);
See Also

Curry(Delegate)

Wraps a delegate to partially apply it.

[RequiresUnreferencedCode("The returned proxy resolves the delegate's invoke operator via the DLR binder on each call; trimming can remove the member being resolved.")]
[RequiresDynamicCode("Invoking the returned proxy requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic Curry(Delegate target)

Parameters

target Delegate

The target.

Returns

dynamic

Curry(object, int?)

Wraps a target to partial apply a method (or target if you can invoke target directly eg delegate).

[RequiresUnreferencedCode("The returned proxy resolves target's invoke/call operator (or, for a named member, InvokeMember) via the DLR binder on each call; trimming can remove the member being resolved.")]
[RequiresDynamicCode("Invoking the returned proxy requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic Curry(object target, int? totalArgCount = null)

Parameters

target object

The target.

totalArgCount int?

The total arg count.

Returns

dynamic

FastDynamicInvoke(Delegate, params object?[])

FastDynamicInvoke extension method. Runs up to runs up to 20x faster than DynamicInvoke(params object[]) .

[RequiresUnreferencedCode("For an argument count with no hand-written fast path, invokes del through the DLR (via a 'dynamic' reference to del) rather than Delegate.DynamicInvoke; trimming can remove the member the DLR resolves.")]
[RequiresDynamicCode("The DLR invocation path requires runtime code generation; not supported when AOT-compiled.")]
public static object? FastDynamicInvoke(this Delegate del, params object?[] args)

Parameters

del Delegate

The del.

args object[]

The args.

Returns

object

GenericDelegateType(int, bool)

Given a generic parameter count and whether it returns void or not gives type of Action or Func

public static Type GenericDelegateType(int paramCount, bool returnVoid = false)

Parameters

paramCount int

The param count.

returnVoid bool

if set to true [return void].

Returns

Type

Type of Action or Func

GetMemberNames(object, bool)

Gets the member names of properties. Not all IDynamicMetaObjectProvider have support for this.

[RequiresUnreferencedCode("For an IDynamicMetaObjectProvider, calls GetMetaObject(...).GetDynamicMemberNames(); for a COM object, resolves member names through a late-bound ComBinder reference. Trimming can remove members either path would otherwise report.")]
[RequiresDynamicCode("The late-bound ComBinder path goes through the DLR, which requires runtime code generation; not supported when AOT-compiled.")]
public static IEnumerable<string> GetMemberNames(object target, bool dynamicOnly = false)

Parameters

target object

The target.

dynamicOnly bool

if set to true [dynamic only]. Won't add reflected properties

Returns

IEnumerable<string>

Invoke(object, params object?[])

Invokes the specified target using the DLR;

[RequiresUnreferencedCode("Resolves target's invoke/call operator via the DLR binder; trimming can remove the member being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic? Invoke(object target, params object?[] args)

Parameters

target object

The target.

args object[]

The args.

Returns

dynamic

InvokeAction(object, params object?[])

Invokes the action using the DLR

[RequiresUnreferencedCode("Resolves target's invoke/call operator via the DLR binder; trimming can remove the member being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static void InvokeAction(object target, params object?[] args)

Parameters

target object

The target.

args object[]

The args.

InvokeAddAssignMember(object, string, object?)

Invokes add assign with correct behavior for events.

[RequiresUnreferencedCode("Resolves the add accessor for 'name' via the DLR binder; trimming can remove the event being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static void InvokeAddAssignMember(object target, string name, object? value)

Parameters

target object

The target.

name string

The name.

value object

The value.

InvokeBinaryOperator(dynamic, ExpressionType, dynamic)

Invokes the binary operator.

[RequiresUnreferencedCode("Every operator case dispatches through 'dynamic' operands, resolved by the DLR binder against the runtime types of leftArg/rightArg; trimming can remove the operator overload being resolved.")]
[RequiresDynamicCode("Dynamic operator dispatch requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic InvokeBinaryOperator(dynamic leftArg, ExpressionType op, dynamic rightArg)

Parameters

leftArg dynamic

The left arg.

op ExpressionType

The op.

rightArg dynamic

The right Arg.

Returns

dynamic

InvokeCallSite(CallSite, object, params object?[])

Dynamically invokes a method determined by the CallSite binder and be given an appropriate delegate type

[RequiresUnreferencedCode("Reads callSite.Target via a 'dynamic' cast (DLR member resolution) before invoking it; trimming can remove the Target member being resolved. Advanced/low-level API - prefer InvokeMember/InvokeGet/etc.")]
[RequiresDynamicCode("The 'dynamic' cast and subsequent invocation both require the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic? InvokeCallSite(CallSite callSite, object target, params object?[] args)

Parameters

callSite CallSite

The Callsite

target object

The target.

args object[]

The args.

Returns

dynamic

Remarks

InvokeConstructor(Type, params object?[])

Invokes the constructor.

[RequiresUnreferencedCode("Resolves type's constructor via the DLR binder; if trimming has removed the constructor, this throws RuntimeBinderException reporting the type as having no constructors at all, even when the untrimmed source plainly declares one.")]
[RequiresDynamicCode("For more than 14 arguments, building the call site emits a delegate type via Reflection.Emit; for 14 or fewer, it binds through Microsoft.CSharp.RuntimeBinder. Both require the DLR's runtime code generation. On a runtime without Reflection.Emit (AOT-compiled, trimmed, or mobile/WebAssembly), more than 14 arguments throws PlatformNotSupportedException instead - see issue #27; 14 or fewer still requires the DLR itself and is not supported when AOT-compiled.")]
public static dynamic? InvokeConstructor(Type type, params object?[] args)

Parameters

type Type

The type.

args object[]

The args.

Returns

dynamic

InvokeConvert(object, Type, bool)

Invokes convert using the DLR.

[RequiresUnreferencedCode("Resolves the conversion operator to 'type' via the DLR binder; trimming can remove the conversion being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic? InvokeConvert(object target, Type type, bool @explicit = false)

Parameters

target object

The target.

type Type

The type.

explicit bool

if set to true [explicit].

Returns

dynamic

InvokeGet(object, string)

Dynamically Invokes a get member using the DLR.

[RequiresUnreferencedCode("Resolves 'name' on target's runtime type via the DLR binder; if trimming has removed the member, this throws RuntimeBinderException reporting the member as entirely absent, even when the untrimmed source plainly declares it.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic? InvokeGet(object target, string name)

Parameters

target object

The target.

name string

The name.

Returns

dynamic

The result.

Examples

Unit Test that describes usage

var tSetValue = "1";
var tAnon = new { Test = tSetValue };

var tOut =Impromptu.InvokeGet(tAnon, "Test");

Assert.AreEqual(tSetValue, tOut);

InvokeGetChain(object, string)

Invokes the getter property chain.

[RequiresUnreferencedCode("Walks propertyChain by calling InvokeGet/InvokeGetIndex, each of which resolves a member via the DLR binder; trimming can remove any member along the chain.")]
[RequiresDynamicCode("Each step in the chain binds through the DLR; not supported when AOT-compiled.")]
public static dynamic? InvokeGetChain(object target, string propertyChain)

Parameters

target object

The target.

propertyChain string

The property chain.

Returns

dynamic

InvokeGetIndex(object, params object?[])

Dynamically Invokes indexer using the DLR.

[RequiresUnreferencedCode("Resolves target's indexer via the DLR binder; trimming can remove the indexer being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic? InvokeGetIndex(object target, params object?[] indexes)

Parameters

target object

The target.

indexes object[]

The indexes.

Returns

dynamic

InvokeIsEvent(object, string)

Determines whether the specified name on target is event. This allows you to know whether to InvokeMemberAction add_{name} or a combo of {invokeGet, +=, invokeSet} and the corresponding remove_{name} or a combo of {invokeGet, -=, invokeSet}

[RequiresUnreferencedCode("Resolves 'name' on target's runtime type via the DLR binder to determine whether it is an event; trimming can remove the member being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static bool InvokeIsEvent(object target, string name)

Parameters

target object

The target.

name string

The name.

Returns

bool

true if the specified target is event; otherwise, false.

InvokeMember(object, String_OR_InvokeMemberName, params object?[])

Dynamically Invokes a member method using the DLR

[RequiresUnreferencedCode("Resolves 'name' on target's runtime type via the DLR binder; if trimming has removed the member, this throws RuntimeBinderException reporting the member as entirely absent, even when the untrimmed source plainly declares it.")]
[RequiresDynamicCode("Every call binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic? InvokeMember(object target, String_OR_InvokeMemberName name, params object?[] args)

Parameters

target object

The target.

name String_OR_InvokeMemberName

The name. Can be a string it will be implicitly converted

args object[]

The args.

Returns

dynamic

The result

Examples

Unit test that exhibits usage:

dynamic tExpando = new ExpandoObject();
tExpando.Func = new Func<int, string>(it => it.ToString());

var tValue = 1;
var tOut = Impromptu.InvokeMember(tExpando, "Func", tValue);

Assert.AreEqual(tValue.ToString(), tOut);

Remarks

If the invoked member's result is a Task<TResult> or a ValueTask<TResult> whose TResult is not visible to the calling assembly (see IsVisible), the result is wrapped in an AwaitableResult instead of being returned directly, so that await Dynamic.InvokeMember(...) succeeds instead of throwing RuntimeBinderException. An inaccessible ValueTask<TResult> is converted with AsTask() first. Every other result - including a plain Task, or a Task<TResult> / ValueTask<TResult> whose TResult is visible - is returned unchanged. See AwaitableResult for why this is safe.

InvokeMemberAction(object, String_OR_InvokeMemberName, params object?[])

Dynamically Invokes a member method which returns void using the DLR

[RequiresUnreferencedCode("Resolves 'name' on target's runtime type via the DLR binder; if trimming has removed the member, this throws RuntimeBinderException reporting the member as entirely absent.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static void InvokeMemberAction(object target, String_OR_InvokeMemberName name, params object?[] args)

Parameters

target object

The target.

name String_OR_InvokeMemberName

The name.

args object[]

The args.

Examples

Unit test that exhibits usage:

var tTest = "Wrong";
var tValue = "Correct";

dynamic tExpando = new ExpandoObject();
tExpando.Action = new Action<string>(it => tTest = it);

Impromptu.InvokeMemberAction(tExpando, "Action", tValue);

Assert.AreEqual(tValue, tTest);

InvokeMemberAsync(object, String_OR_InvokeMemberName, params object?[])

Dynamically invokes a member method using the DLR, the same as InvokeMember(object, String_OR_InvokeMemberName, params object?[]), then awaits its result without going through dynamic binding. Since InvokeMember(object, String_OR_InvokeMemberName, params object?[]) now wraps an inaccessible-TResult task in an AwaitableResult automatically, await Dynamic.InvokeMember(...) works directly and this method is no longer required to make that case succeed. It remains supported for callers who prefer awaiting inside a single non-dynamic Task<TResult>-returning call, without an intermediate dynamic await expression.

[RequiresUnreferencedCode("Calls InvokeMember, which resolves 'name' via the DLR binder and can fail against a trimmed target.")]
[RequiresDynamicCode("Calls InvokeMember, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static Task<object?> InvokeMemberAsync(object target, String_OR_InvokeMemberName name, params object?[] args)

Parameters

target object

The target.

name String_OR_InvokeMemberName

The name. Can be a string; it will be implicitly converted.

args object[]

The args.

Returns

Task<object>

A task that completes with the invoked member's result, boxed to object (null if the invoked member returns a non-generic Task).

Remarks

This method invokes the member exactly as InvokeMember(object, String_OR_InvokeMemberName, params object?[]) does, then hands the result to AwaitResult(object?), which accepts either the raw Task or the AwaitableResult wrapper InvokeMember(object, String_OR_InvokeMemberName, params object?[]) may have returned, and awaits it through reflection instead of the DLR.

Exceptions

InvalidOperationException

The invoked member did not return a Task.

InvokeSet(object, string, object?)

Dynamically Invokes a set member using the DLR.

[RequiresUnreferencedCode("Resolves 'name' on target's runtime type via the DLR binder (falling back to reflection for a static context); trimming can remove the member being resolved.")]
[RequiresDynamicCode("The DLR binder path requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static object? InvokeSet(object target, string name, object? value)

Parameters

target object

The target.

name string

The name.

value object

The value.

Returns

object

Examples

Unit test that exhibits usage:

dynamic tExpando = new ExpandoObject();

var tSetValue = "1";

Impromptu.InvokeSet(tExpando, "Test", tSetValue);

Assert.AreEqual(tSetValue, tExpando.Test);

Remarks

if you call a static property off a type with a static context the csharp dlr binder won't do it, so this method reverts to reflection

InvokeSetChain(object, string, object)

Invokes the set on the end of a property chain.

[RequiresUnreferencedCode("Walks propertyChain by calling InvokeGet/InvokeGetIndex/InvokeSet, each of which resolves a member via the DLR binder; trimming can remove any member along the chain.")]
[RequiresDynamicCode("Each step in the chain binds through the DLR; not supported when AOT-compiled.")]
public static object InvokeSetChain(object target, string propertyChain, object value)

Parameters

target object

The target.

propertyChain string

The property chain.

value object

The value.

Returns

object

InvokeSetIndex(object, params object?[])

Invokes setindex.

[RequiresUnreferencedCode("Resolves target's indexer setter via the DLR binder; trimming can remove the indexer being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static object? InvokeSetIndex(object target, params object?[] indexesThenValue)

Parameters

target object

The target.

indexesThenValue object[]

The indexes then value.

Returns

object

InvokeSetValueOnIndexes(object, object?, params object?[])

Convenience version of InvokeSetIndex that separates value and indexes.

[RequiresUnreferencedCode("Forwards to InvokeSetIndex, which resolves target's indexer via the DLR binder.")]
[RequiresDynamicCode("Forwards to InvokeSetIndex, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static object? InvokeSetValueOnIndexes(object target, object? value, params object?[] indexes)

Parameters

target object

The target.

value object

The value

indexes object[]

The indexes

Returns

object

InvokeSubtractAssignMember(object, string, object?)

Invokes subtract assign with correct behavior for events.

[RequiresUnreferencedCode("Resolves the remove accessor for 'name' via the DLR binder; trimming can remove the event being resolved.")]
[RequiresDynamicCode("Binds through Microsoft.CSharp.RuntimeBinder, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static void InvokeSubtractAssignMember(object target, string name, object? value)

Parameters

target object

The target.

name string

The name.

value object

The value.

InvokeUnaryOpartor(ExpressionType, dynamic)

Invokes a unary operator. Misspelled alias of InvokeUnaryOperator(ExpressionType, dynamic), kept only so existing callers keep compiling; it forwards there unchanged.

[Obsolete("Use `InvokeUnaryOperator` instead.")]
[RequiresUnreferencedCode("Forwards to InvokeUnaryOperator, which dispatches through a 'dynamic' operand resolved by the DLR binder.")]
[RequiresDynamicCode("Forwards to InvokeUnaryOperator, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic InvokeUnaryOpartor(ExpressionType op, dynamic arg)

Parameters

op ExpressionType

The unary operator to apply.

arg dynamic

The operand.

Returns

dynamic

The result of applying op to arg.

InvokeUnaryOperator(ExpressionType, dynamic)

Invokes the unary operator.

[RequiresUnreferencedCode("Every operator case dispatches through a 'dynamic' operand, resolved by the DLR binder against arg's runtime type; trimming can remove the operator overload being resolved.")]
[RequiresDynamicCode("Dynamic operator dispatch requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public static dynamic InvokeUnaryOperator(ExpressionType op, dynamic arg)

Parameters

op ExpressionType

The op.

arg dynamic

The arg.

Returns

dynamic

IsDBNull(object?)

Determines whether value is DBNull dynamically (Useful for PCL)

[RequiresUnreferencedCode("Resolves System.Convert.IsDBNull dynamically (via a late-bound Convert reference) rather than calling it directly; trimming Convert's public surface breaks this.")]
[RequiresDynamicCode("Constructing the underlying LateType and making the late-bound call both require the DLR's runtime code generation; not supported when AOT-compiled.")]
public static bool IsDBNull(object? value)

Parameters

value object

The value.

Returns

bool

true if [is DBNull]; otherwise, false.

Linq(object)

Puts a dynamic linq proxy around the specified enumerable.

[RequiresUnreferencedCode("Wraps enumerable in a dynamic LINQ proxy that resolves Enumerable/Queryable extension methods by name and generic signature via reflection at each call; trimming can remove the method being resolved.")]
[RequiresDynamicCode("Each LINQ-style call through the returned proxy binds through the DLR and, for multi-generic-argument methods, may build the closed generic method at runtime; not supported when AOT-compiled.")]
public static dynamic Linq(object enumerable)

Parameters

enumerable object

The enumerable.

Returns

dynamic