Created
September 20, 2023 10:02
-
-
Save in-async/cd19e7f9c6e7d9ec8db202cc5c4b3b62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ObjectInvokeExtensions { | |
public static TResult Invoke<T, TResult>(this T value, Func<T, TResult> func) { | |
if (func is null) { throw new ArgumentNullException(nameof(func)); } | |
return func(value); | |
} | |
public static void Invoke<T>(this T value, Action<T> action) { | |
if (action is null) { throw new ArgumentNullException(nameof(action)); } | |
action(value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment