Csharp/C Sharp/Development Class/Stopwatch

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Use Stopwatch

using System;
using System.Reflection;
using System.Diagnostics;
class OnlyLoad {
    static void Main() {
        Stopwatch duration = new Stopwatch();
        duration.Reset();
        duration.Start();
        Assembly a = Assembly.Load("library");
        duration.Stop();
        Console.WriteLine(duration.ElapsedTicks.ToString());
        duration.Reset();
        duration.Start();
        a = Assembly.ReflectionOnlyLoad("library");
        duration.Stop();
        Console.WriteLine(duration.ElapsedTicks.ToString());
    }
}