コード例 #1
0
ファイル: source2.cs プロジェクト: zhimaqiao51/docs
    public static void Main()
    {
        EventTester ev = new EventTester();

        // Add two handlers to the event
        ev.TestEvent += Handler1;
        ev.TestEvent += Handler2;

        // Show what handlers are set to the event
        ev.ShowEventInfo();
        Console.WriteLine();
        // Invoke the handlers
        ev.OnTestEvent();
        Console.WriteLine();
        // Reorder the invocation list
        ev.ReverseInvocationList();
        // Invoke the handlers again
        ev.OnTestEvent();
    }