using KGySoft.CoreLibraries;
using KGySoft.Diagnostics;
public class RandomizedPerformanceTest<T> : PerformanceTestBase<Func<Random, T>, T>
public int Seed { get; set; }
protected override T Invoke(Func<Random, T> del) { return del.Invoke(random); }
protected override void OnBeforeCase() { random = new Random(Seed); }
public static void Main()
new RandomizedPerformanceTest<string>
.AddCase(rnd => rnd.NextEnum<ConsoleColor>().ToString(), "Enum.ToString")
.AddCase(rnd => Enum<ConsoleColor>.ToString(rnd.NextEnum<ConsoleColor>()), "Enum<TEnum>.ToString")
.DumpResults(Console.Out);