Created
April 10, 2010 15:01
-
-
Save mneedham/362051 to your computer and use it in GitHub Desktop.
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 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