Last active
August 29, 2015 14:03
-
-
Save einarwh/39f9d1ec870c7ae8682c 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 | |
{ | |
static Func<TR> Catch<TR, TE>( | |
this Func<TR> f, | |
Func<TE, TR> h) | |
where TE : Exception | |
{ | |
return () => { | |
try { | |
return f (); | |
} catch (TE ex) { | |
return h (ex); | |
}; | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment