Created
November 10, 2011 15:01
-
-
Save takeshik/1355047 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
var p = Expression.Parameter(typeof(int)); | |
var expr = Expression.Lambda<Action>( | |
Expression.Call( | |
typeof(EnumerableEx), | |
"ForEach", | |
new [] { typeof(int) }, | |
Expression.Call( | |
typeof(Enumerable), | |
"Range", | |
Type.EmptyTypes, | |
Expression.Constant(1), | |
Expression.Constant(12) | |
), | |
Expression.Lambda( | |
Expression.Call( | |
typeof(Console), | |
"WriteLine", | |
Type.EmptyTypes, | |
Expression.Constant("{0}月は Expression Trees で酒が飲める飲めるぞー!酒が飲めるぞー!"), | |
Expression.Convert(p, typeof(object)) | |
), | |
p | |
) | |
) | |
); | |
// Run: | |
expr.Compile()(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment