InvocationList
Provides various extensions for InvocationList<T> type.
using System;
using System.Runtime.CompilerServices;
namespace DotNext.Collections.Specialized
{
public static class InvocationList
{
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})]
public static ReadOnlySpan<TDelegate> AsSpan<TDelegate>([System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})] ref InvocationList<TDelegate> delegates) where TDelegate : MulticastDelegate
{
return InvocationList<TDelegate>.GetList(ref delegates);
}
[System.Runtime.CompilerServices.NullableContext(1)]
public static void Invoke<[System.Runtime.CompilerServices.Nullable(2)] T>([System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1
})] this InvocationList<Action<T>> actions, T arg)
{
ReadOnlySpan<Action<T>> readOnlySpan = ref actions.AsSpan();
for (int i = 0; i < readOnlySpan.Length; i++) {
readOnlySpan[i](arg);
}
}
[System.Runtime.CompilerServices.NullableContext(1)]
public static void Invoke<[System.Runtime.CompilerServices.Nullable(2)] T1, [System.Runtime.CompilerServices.Nullable(2)] T2>([System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1,
1,
1
})] this InvocationList<Action<T1, T2>> actions, T1 arg1, T2 arg2)
{
ReadOnlySpan<Action<T1, T2>> readOnlySpan = ref actions.AsSpan();
for (int i = 0; i < readOnlySpan.Length; i++) {
readOnlySpan[i](arg1, arg2);
}
}
}
}