ValueAction<T1, T2, T3, T4, T5>
public struct ValueAction<T1, T2, T3, T4, T5> : IValueDelegate<Action<T1, T2, T3, T4, T5>>, ICallable<Action<T1, T2, T3, T4, T5>>, ICallable, IConvertible<Action<T1, T2, T3, T4, T5>>, ISupplier<Action<T1, T2, T3, T4, T5>>, IEquatable<ValueAction<T1, T2, T3, T4, T5>>
Represents a pointer to the method with fifth parameters and Void return type.
using DotNext.Runtime;
using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace DotNext
{
[StructLayout(LayoutKind.Auto)]
[System.Runtime.CompilerServices.NullableContext(2)]
[System.Runtime.CompilerServices.Nullable(0)]
public readonly struct ValueAction<T1, T2, T3, T4, T5> : IValueDelegate<Action<T1, T2, T3, T4, T5>>, ICallable<Action<T1, T2, T3, T4, T5>>, ICallable, IConvertible<Action<T1, T2, T3, T4, T5>>, ISupplier<Action<T1, T2, T3, T4, T5>>, IEquatable<ValueAction<T1, T2, T3, T4, T5>>
{
private readonly IntPtr methodPtr;
[System.Runtime.CompilerServices.Nullable(new byte[] {
2,
1,
1,
1,
1,
1
})]
private readonly Action<T1, T2, T3, T4, T5> action;
public bool IsEmpty {
get {
if (action == null)
return methodPtr == (IntPtr)0;
return false;
}
}
public object Target => action?.Target;
[System.Runtime.CompilerServices.NullableContext(1)]
public ValueAction(MethodInfo method)
{
this = new ValueAction<T1, T2, T3, T4, T5>(DelegateHelpers.CreateDelegate<Action<T1, T2, T3, T4, T5>>(method, (object)null), false);
}
[System.Runtime.CompilerServices.NullableContext(1)]
public ValueAction(Action<T1, T2, T3, T4, T5> action, bool wrap = false)
{
if (action == null)
throw new ArgumentNullException("action");
if (wrap || DelegateHelpers.IsRegularDelegate(action)) {
this.action = action;
methodPtr = default(IntPtr);
} else {
this.action = null;
methodPtr = action.Method.MethodHandle.GetFunctionPointer();
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[EditorBrowsable(EditorBrowsableState.Never)]
[CLSCompliant(false)]
public ValueAction(IntPtr methodPtr)
{
action = null;
this.methodPtr = methodPtr;
}
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
1,
1,
1,
1,
1
})]
public Action<T1, T2, T3, T4, T5> ToDelegate()
{
if (methodPtr != (IntPtr)0)
return new Action<T1, T2, T3, T4, T5>(null, methodPtr);
return action;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public void Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
{
if (methodPtr != (IntPtr)0)
;
else
action(arg1, arg2, arg3, arg4, arg5);
}
object ICallable.DynamicInvoke([System.Runtime.CompilerServices.Nullable(new byte[] {
1,
2
})] params object[] args)
{
Invoke(Intrinsics.NullAwareCast<T1>(args[0]), Intrinsics.NullAwareCast<T2>(args[1]), Intrinsics.NullAwareCast<T3>(args[2]), Intrinsics.NullAwareCast<T4>(args[3]), Intrinsics.NullAwareCast<T5>(args[4]));
return null;
}
public static explicit operator Action<T1, T2, T3, T4, T5>([In] [IsReadOnly] [System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1,
1,
1,
1
})] ref ValueAction<T1, T2, T3, T4, T5> pointer)
{
return pointer.ToDelegate();
}
public override int GetHashCode()
{
return action?.GetHashCode() ?? methodPtr.GetHashCode();
}
public bool Equals([System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1,
1,
1,
1
})] ValueAction<T1, T2, T3, T4, T5> other)
{
if (methodPtr == other.methodPtr)
return object.Equals(action, other.action);
return false;
}
public override bool Equals(object other)
{
if (other is ValueAction<T1, T2, T3, T4, T5>) {
ValueAction<T1, T2, T3, T4, T5> other2 = (ValueAction<T1, T2, T3, T4, T5>)other;
return Equals(other2);
}
return false;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public override string ToString()
{
return action?.ToString() ?? methodPtr.ToString("X");
}
public static bool operator ==([In] [IsReadOnly] [System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1,
1,
1,
1
})] ref ValueAction<T1, T2, T3, T4, T5> first, [In] [IsReadOnly] [System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1,
1,
1,
1
})] ref ValueAction<T1, T2, T3, T4, T5> second)
{
if (first.methodPtr == second.methodPtr)
return object.Equals(first.action, second.action);
return false;
}
public static bool operator !=([In] [IsReadOnly] [System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1,
1,
1,
1
})] ref ValueAction<T1, T2, T3, T4, T5> first, [In] [IsReadOnly] [System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1,
1,
1,
1
})] ref ValueAction<T1, T2, T3, T4, T5> second)
{
if (!(first.methodPtr != second.methodPtr))
return !object.Equals(first.action, second.action);
return true;
}
}
}