fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5.  
  6. public class Test
  7. {
  8. public static void Execute(int i) {
  9. Console.WriteLine("{0}", i);
  10. }
  11. public static void Main()
  12. {
  13. var exec = typeof(Test).GetMethod("Execute");
  14. var actions = new List<Action>();
  15. for (int i = 0 ; i != 100 ; i++) {
  16. var val = Expression.Constant(i+100100100);
  17. var call = Expression.Call(exec, val);
  18. var lambda = Expression.Lambda(typeof(Action), call, new ParameterExpression[0]);
  19. actions.Add((Action)lambda.Compile());
  20. }
  21. foreach (var a in actions) a();
  22. }
  23. }
Success #stdin #stdout 0.08s 34552KB
stdin
Standard input is empty
stdout
100100100
100100101
100100102
100100103
100100104
100100105
100100106
100100107
100100108
100100109
100100110
100100111
100100112
100100113
100100114
100100115
100100116
100100117
100100118
100100119
100100120
100100121
100100122
100100123
100100124
100100125
100100126
100100127
100100128
100100129
100100130
100100131
100100132
100100133
100100134
100100135
100100136
100100137
100100138
100100139
100100140
100100141
100100142
100100143
100100144
100100145
100100146
100100147
100100148
100100149
100100150
100100151
100100152
100100153
100100154
100100155
100100156
100100157
100100158
100100159
100100160
100100161
100100162
100100163
100100164
100100165
100100166
100100167
100100168
100100169
100100170
100100171
100100172
100100173
100100174
100100175
100100176
100100177
100100178
100100179
100100180
100100181
100100182
100100183
100100184
100100185
100100186
100100187
100100188
100100189
100100190
100100191
100100192
100100193
100100194
100100195
100100196
100100197
100100198
100100199