patterns-group / code-patterns

Code Patterns: lots of reusable goodies for your .NET project
tribesoftware.org/code-patterns/
BSD 2-Clause "Simplified" License
9 stars 9 forks source link

Try enhancements #164

Closed jbatte47 closed 10 years ago

jbatte47 commented 10 years ago

It would be nice to optionally specify actions and functions to run at each stage of the try/catch/finally block. That would look something like:

Try.Do(Work, final: () => Debug.WriteLine("Work complete"));
int count = Try.Get(Count, final: result =>
  Debug.WriteLine(string.Format("Count retrieved: {0}", result)));