Struct ValueRefAction<T, TArgs>
Represents action that accepts arbitrary value by reference.
Inherited Members
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public struct ValueRefAction<T, TArgs> : IValueDelegate<RefAction<T, TArgs>>, ICallable<RefAction<T, TArgs>>, ICallable, IConvertible<RefAction<T, TArgs>>, ISupplier<RefAction<T, TArgs>>, IEquatable<ValueRefAction<T, TArgs>>
Type Parameters
Name | Description |
---|---|
T | The type of the object to be passed by reference into the action. |
TArgs | The type of the arguments to be passed into the action. |
Remarks
This method pointer is intended to call managed methods only.
Constructors
| Improve this Doc View SourceValueRefAction(RefAction<T, TArgs>, Boolean)
Initializes a new pointer based on extracted pointer from the delegate.
Declaration
public ValueRefAction(RefAction<T, TArgs> action, bool wrap = false)
Parameters
Type | Name | Description |
---|---|---|
RefAction<T, TArgs> | action | The delegate representing method. |
Boolean | wrap | true to wrap |
Remarks
You can use this constructor to create value delegate once and cache it using static readonly
field
for subsequent calls.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ValueRefAction(MethodInfo)
Initializes a new pointer to the method.
Declaration
public ValueRefAction(MethodInfo method)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | method | The method to convert into pointer. |
Remarks
This constructor causes heap allocations because Reflection is needed to check compatibility of method's signature with the delegate type.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException | Signature of |
Properties
| Improve this Doc View SourceIsEmpty
Indicates that this delegate doesn't refer to any method.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
Target
Gets the object on which the current pointer invokes the method.
Declaration
public object Target { get; }
Property Value
Type | Description |
---|---|
Object |
Methods
| Improve this Doc View SourceEquals(ValueRefAction<T, TArgs>)
Determines whether this object points to the same method as other object.
Declaration
public bool Equals(ValueRefAction<T, TArgs> other)
Parameters
Type | Name | Description |
---|---|---|
ValueRefAction<T, TArgs> | other | The pointer to compare. |
Returns
Type | Description |
---|---|
Boolean | true if both pointers represent the same method; otherwise, false. |
Equals(Object)
Determines whether this object points to the same method as other object.
Declaration
public override bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
Object | other | The object implementing ICallable<TDelegate> to compare. |
Returns
Type | Description |
---|---|
Boolean | true if both pointers represent the same method; otherwise, false. |
Overrides
| Improve this Doc View SourceGetHashCode()
Computes hash code of this pointer.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code of this pointer. |
Overrides
| Improve this Doc View SourceInvoke(ref T, TArgs)
Invokes method by pointer.
Declaration
public void Invoke(ref T reference, TArgs args)
Parameters
Type | Name | Description |
---|---|---|
T | reference | The object passed by reference. |
TArgs | args | The action arguments. |
ToDelegate()
Converts this pointer into RefAction<T, TArgs>.
Declaration
public RefAction<T, TArgs> ToDelegate()
Returns
Type | Description |
---|---|
RefAction<T, TArgs> | The delegate created from this method pointer; or null if this pointer is zero. |
ToString()
Obtains pointer value in HEX format.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The address represented by pointer. |
Overrides
Operators
| Improve this Doc View SourceEquality(ValueRefAction<T, TArgs>, ValueRefAction<T, TArgs>)
Determines whether the pointers represent the same method.
Declaration
public static bool operator ==(in ValueRefAction<T, TArgs> first, in ValueRefAction<T, TArgs> second)
Parameters
Type | Name | Description |
---|---|---|
ValueRefAction<T, TArgs> | first | The first pointer to compare. |
ValueRefAction<T, TArgs> | second | The second pointer to compare. |
Returns
Type | Description |
---|---|
Boolean | true if both pointers represent the same method; otherwise, false. |
Explicit(ValueRefAction<T, TArgs> to RefAction<T, TArgs>)
Converts this pointer into RefAction<T, TArgs>.
Declaration
public static explicit operator RefAction<T, TArgs>(in ValueRefAction<T, TArgs> pointer)
Parameters
Type | Name | Description |
---|---|---|
ValueRefAction<T, TArgs> | pointer | The pointer to convert. |
Returns
Type | Description |
---|---|
RefAction<T, TArgs> | The delegate created from this method pointer. |
Inequality(ValueRefAction<T, TArgs>, ValueRefAction<T, TArgs>)
Determines whether the pointers represent different methods.
Declaration
public static bool operator !=(in ValueRefAction<T, TArgs> first, in ValueRefAction<T, TArgs> second)
Parameters
Type | Name | Description |
---|---|---|
ValueRefAction<T, TArgs> | first | The first pointer to compare. |
ValueRefAction<T, TArgs> | second | The second pointer to compare. |
Returns
Type | Description |
---|---|
Boolean | true if both pointers represent different methods; otherwise, false. |
Explicit Interface Implementations
| Improve this Doc View SourceICallable.DynamicInvoke(Object[])
Declaration
object ICallable.DynamicInvoke(params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Object[] | args |
Returns
Type | Description |
---|---|
Object |