DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.0.0-rc.2" />

 InvocationList

public static class 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 delegates.Span; } [System.Runtime.CompilerServices.NullableContext(1)] public static void Invoke<[System.Runtime.CompilerServices.Nullable(2)] T>([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] ref InvocationList<Action<T>> actions, T arg) { ReadOnlySpan<Action<T>> span = actions.Span; for (int i = 0; i < span.Length; i++) { span[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 })] ref InvocationList<Action<T1, T2>> actions, T1 arg1, T2 arg2) { ReadOnlySpan<Action<T1, T2>> span = actions.Span; for (int i = 0; i < span.Length; i++) { span[i](arg1, arg2); } } } }