Show / Hide Table of Contents

Struct ValueAction<T>

Represents a pointer to the method with single parameter and Void return type.

Implements
ICallable<Action<T>>
ICallable
IConvertible<Action<T>>
IEquatable<ValueAction<T>>
Inherited Members
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public struct ValueAction<T> : IValueDelegate<Action<T>>, ICallable<Action<T>>, ICallable, IConvertible<Action<T>>, ISupplier<Action<T>>, IEquatable<ValueAction<T>>, IConsumer<T>
Type Parameters
Name Description
T

The type of the first method parameter.

Remarks

This method pointer is intended to call managed methods only.

Constructors

| Improve this Doc View Source

ValueAction(Action<T>, Boolean)

Initializes a new pointer based on extracted pointer from the delegate.

Declaration
public ValueAction(Action<T> action, bool wrap = false)
Parameters
Type Name Description
Action<T> action

The delegate representing method.

Boolean wrap

true to wrap action into this delegate; false to extract method pointer without holding reference to the passed delegate.

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

action is null.

| Improve this Doc View Source

ValueAction(MethodInfo)

Initializes a new pointer to the method.

Declaration
public ValueAction(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

method is null.

ArgumentException

Signature of method doesn't match to this pointer type.

Properties

| Improve this Doc View Source

IsEmpty

Indicates that this delegate doesn't refer to any method.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

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 Source

Equals(ValueAction<T>)

Determines whether this object points to the same method as other object.

Declaration
public bool Equals(ValueAction<T> other)
Parameters
Type Name Description
ValueAction<T> other

The pointer to compare.

Returns
Type Description
Boolean

true if both pointers represent the same method; otherwise, false.

| Improve this Doc View Source

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
ValueType.Equals(Object)
| Improve this Doc View Source

GetHashCode()

Computes hash code of this pointer.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

The hash code of this pointer.

Overrides
ValueType.GetHashCode()
| Improve this Doc View Source

Invoke(T)

Invokes method by pointer.

Declaration
public void Invoke(T arg)
Parameters
Type Name Description
T arg

The first argument to be passed into the target method.

| Improve this Doc View Source

ToDelegate()

Converts this pointer into Action<T>.

Declaration
public Action<T> ToDelegate()
Returns
Type Description
Action<T>

The delegate created from this method pointer; or null if this pointer is zero.

| Improve this Doc View Source

ToString()

Obtains pointer value in HEX format.

Declaration
public override string ToString()
Returns
Type Description
String

The address represented by pointer.

Overrides
ValueType.ToString()

Operators

| Improve this Doc View Source

Equality(ValueAction<T>, ValueAction<T>)

Determines whether the pointers represent the same method.

Declaration
public static bool operator ==(in ValueAction<T> first, in ValueAction<T> second)
Parameters
Type Name Description
ValueAction<T> first

The first pointer to compare.

ValueAction<T> second

The second pointer to compare.

Returns
Type Description
Boolean

true if both pointers represent the same method; otherwise, false.

| Improve this Doc View Source

Explicit(ValueAction<T> to Action<T>)

Converts this pointer into Action<T>.

Declaration
public static explicit operator Action<T>(in ValueAction<T> pointer)
Parameters
Type Name Description
ValueAction<T> pointer

The pointer to convert.

Returns
Type Description
Action<T>

The delegate created from this method pointer.

| Improve this Doc View Source

Inequality(ValueAction<T>, ValueAction<T>)

Determines whether the pointers represent different methods.

Declaration
public static bool operator !=(in ValueAction<T> first, in ValueAction<T> second)
Parameters
Type Name Description
ValueAction<T> first

The first pointer to compare.

ValueAction<T> 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 Source

ICallable.DynamicInvoke(Object[])

Declaration
object ICallable.DynamicInvoke(params object[] args)
Parameters
Type Name Description
Object[] args
Returns
Type Description
Object

Implements

ICallable<TDelegate>
ICallable
IConvertible<T>
System.IEquatable<T>

Extension Methods

ValueTypeExtensions.IsOneOf<T>(T, IEnumerable<T>)
ValueTypeExtensions.IsOneOf<T>(T, T[])
Sequence.Skip<TEnumerator, T>(ref TEnumerator, Int32)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX