Last active
August 29, 2015 14:03
-
-
Save einarwh/6108ce9c0e09f7e79509 to your computer and use it in GitHub Desktop.
This file contains 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
static class CatchExtensions | |
{ | |
Func<TR> CatchAll<TR>( | |
this Func<TR> f, | |
params Func<Func<TR>, Func<TR>>[] catchers) | |
{ | |
var protect = catchers.Aggregate((acc, nxt) => thing => nxt(acc(thing))); | |
return protect(f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment