using System; using System.Linq; using System.Collections.Generic; using System.Collections.Concurrent; using System.Reflection; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; var watch = System.Diagnostics.Stopwatch.StartNew(); int first = Work(10); bool stable = true; for (int run = 0; run < 2000; run++) stable &= Work(10) == first; watch.Stop(); Console.WriteLine($"value:{first}"); Console.WriteLine($"stable:{stable}"); Console.Error.WriteLine($"dynamic-supported:{System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported};dynamic-compiled:{System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled};elapsed-ticks:{watch.ElapsedTicks}"); static int Work(int count) { int total = 0; for (int i = 0; i < count; i++) total = checked(total + i); return total; }