perf: delegate InvokeSafe method allocations are lowered

This commit is contained in:
Syntriax 2025-05-29 00:16:00 +03:00
parent feb2a05aa3
commit 61a7f685c1

View File

@ -6,7 +6,7 @@ public static class DelegateExtensions
{ {
public static void InvokeSafe(this Delegate @delegate, params object?[] args) public static void InvokeSafe(this Delegate @delegate, params object?[] args)
{ {
foreach (Delegate invocation in @delegate.GetInvocationList()) foreach (Delegate invocation in Delegate.EnumerateInvocationList(@delegate))
try { invocation.DynamicInvoke(args); } try { invocation.DynamicInvoke(args); }
catch (Exception exception) catch (Exception exception)
{ {