Created
May 2, 2021 15:31
-
-
Save sgaliamov/f6dcfe7088951c5782fdec3a75c74b76 to your computer and use it in GitHub Desktop.
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
| using static CustomExtensions.Functions; | |
| ... | |
| var foo = new DynamicMethod("Foo", typeof(int), new[] { typeof(int) }) | |
| .GetILGenerator() | |
| .UseIlluminator( | |
| enableTraceLogger: true, // enable tracing (optional) | |
| Ret(If(Ceq(Ldarg_0(), Ldc_I4_2()), // condition | |
| Ldc_I4_1(), // then | |
| Add(Ldarg_0(), Ldc_I4_3())))) // else | |
| .CreateDelegate<Func<int, int>>(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment