Skip to content

Instantly share code, notes, and snippets.

@mneedham
Created April 10, 2010 15:01
Show Gist options
  • Select an option

  • Save mneedham/362051 to your computer and use it in GitHub Desktop.

Select an option

Save mneedham/362051 to your computer and use it in GitHub Desktop.
public class FooRepository
{
public void Find(int fooId, Action<Foo> foundFoo, Action noFooFound)
{
var foo = LookUpFooFromDatabase();
if(foo == null)
{
noFooFound();
}
foundFoo(foo);
}
}
public class FooController
{
public void TheAction(int fooId)
{
fooRepository.Find(fooId,
foo => //do something with foo,
() => throw new Exception("couldn't find a foo"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment