Class PartialApply
- Namespace
- Dynamitey
- Assembly
- Dynamitey.Community.dll
Internal method for subsequent invocations of Curry(object, int?)
public class PartialApply : DynamicObject, IDynamicMetaObjectProvider, IPartialApply
- Inheritance
-
PartialApply
- Implements
- Inherited Members
Constructors
PartialApply(object, object?[], string?, int?, InvocationKind?)
Initializes a new instance of the PartialApply class.
[RequiresDynamicCode("Constructing a PartialApply instantiates System.Dynamic.DynamicObject, whose default constructor requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public PartialApply(object target, object?[] args, string? memberName = null, int? totalCount = null, InvocationKind? invocationKind = null)
Parameters
targetobjectThe target.
argsobject[]The args.
memberNamestringName of the member.
totalCountint?The total count.
invocationKindInvocationKind?Kind of the invocation.
Properties
Args
Gets the args.
public object?[] Args { get; }
Property Value
- object[]
The args.
InvocationKind
Gets the kind of the invocation.
public InvocationKind InvocationKind { get; }
Property Value
- InvocationKind
The kind of the invocation.
MemberName
Gets the name of the member.
public string? MemberName { get; }
Property Value
- string
The name of the member.
Target
Gets the target.
public object Target { get; }
Property Value
- object
The target.
TotalArgCount
Gets the total arg count.
public int? TotalArgCount { get; }
Property Value
- int?
The total arg count.
Methods
TryBinaryOperation(BinaryOperationBinder, object, out object?)
Provides implementation for binary operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as addition and multiplication.
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Invokes 'this' through 'dynamic' (DLR), same as the | operator above, but this is a DynamicObject.TryBinaryOperation 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 DLR invocation as above; see the IL2026 suppression on this member.")]
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object? result)
Parameters
binderBinaryOperationBinderProvides information about the binary operation. The binder.Operation property returns an 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.
argobjectThe right operand for the binary operation. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class,
argis equal to second.resultobjectThe result of the binary operation.
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.)
TryConvert(ConvertBinder, out object?)
Provides implementation for type conversion operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that convert an object from one type to another.
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated Dynamic.CoerceToDelegate. This is a DynamicObject.TryConvert 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 conversion already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same Dynamic.CoerceToDelegate call as above; see the IL2026 suppression on this member.")]
public override bool TryConvert(ConvertBinder binder, out object? result)
Parameters
binderConvertBinderProvides 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 DynamicObject class, binder.Type returns the 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.
resultobjectThe result of the type conversion operation.
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.)
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 Delegate.FastDynamicInvoke and Invocation.Invoke. 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 invocation already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same FastDynamicInvoke/Invocation.Invoke calls as above; see the IL2026 suppression on this member.")]
public override bool TryInvoke(InvokeBinder binder, object?[]? args, out object? result)
Parameters
binderInvokeBinderProvides information about the invoke operation.
argsobject[]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.resultobjectThe 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.
Operators
operator |(dynamic, PartialApply)
Pipes the argument into the function
[RequiresUnreferencedCode("Invokes function through 'dynamic', resolved via the DLR binder; trimming can remove the member being resolved.")]
[RequiresDynamicCode("The 'dynamic' invocation binds through the DLR, which requires runtime code generation; not supported when AOT-compiled.")]
public static dynamic operator |(dynamic argument, PartialApply function)
Parameters
argumentdynamicThe argument.
functionPartialApplyThe function.
Returns
- dynamic