Last active
March 7, 2025 02:59
-
-
Save twogood/77e8f705d76554d6136039e7a52cc659 to your computer and use it in GitHub Desktop.
Kotlin Scope Functions (Also, Let, Run) in C# .NET Core
This file contains hidden or 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 ScopeFunctions | |
{ | |
public static T Also<T>(this T self, Action<T> action) | |
{ | |
action(self); | |
return self; | |
} | |
public static TResult Let<T, TResult>(this T self, Func<T, TResult> func) => func(self); | |
public static TResult Run<TResult>(Func<TResult> func) => func(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment