PerformanceTest.Benchmark.PrepareSystemForBenchmark C# (CSharp) Method

PrepareSystemForBenchmark() public static method

Prepares the system for benchmark will force Garbage Collection to run with maximum generation and wait it to finish.
public static PrepareSystemForBenchmark ( ) : void
return void
        public static void PrepareSystemForBenchmark ()
        {
            GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers ();
            GC.Collect ();
            System.Threading.Thread.Sleep (0);
        }