Skip to content

Instantly share code, notes, and snippets.

@nbarnwell
Created May 9, 2024 17:37
Show Gist options
  • Save nbarnwell/5c8dc72e29e45390622e17191ac8088b to your computer and use it in GitHub Desktop.
Save nbarnwell/5c8dc72e29e45390622e17191ac8088b to your computer and use it in GitHub Desktop.
Static Provider Example
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