Created
May 9, 2024 17:37
-
-
Save nbarnwell/5c8dc72e29e45390622e17191ac8088b to your computer and use it in GitHub Desktop.
Static Provider Example
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 MealProvider | |
{ | |
private static Func<Meal> _provider = () => new DefaultMeal(); | |
public static void Configure(Func<Meal> provider) | |
{ | |
_provider = provider; | |
} | |
public static Meal NewMeal() | |
{ | |
return _provider(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment