Created
May 30, 2012 02:24
-
-
Save valvallow/2832973 to your computer and use it in GitHub Desktop.
statement to expression
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
| void example() { | |
| var b = Expr<bool>(() => { | |
| switch (1) { | |
| case 1: return true; | |
| default: return false; | |
| } | |
| }); | |
| } |
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 static TReturn Expr<TReturn>(Func<TReturn> body) { | |
| return body(); | |
| } | |
| public static TReturn Progn<TReturn>(Func<TReturn> body) { | |
| return body(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment