Skip to content

Instantly share code, notes, and snippets.

@jciechowski
Created February 12, 2018 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jciechowski/6e39eb7715658bc9e9745a09c749967f to your computer and use it in GitHub Desktop.
Save jciechowski/6e39eb7715658bc9e9745a09c749967f to your computer and use it in GitHub Desktop.
public PizzaRepository() => _pizzas = new List<Pizza>()
public Maybe<Pizza> Get(int id)
{
var pizza = _pizzas.FirstOrDefault(_ => _.Id == id);
return pizza == null ? Maybe.Empty<Pizza>() : pizza.ToMaybe();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment