示例#1
0
        private static void WithEventOnSomeCustomEvent(string s)
        {
            object obj = new ClassWithEvent();

            Console.WriteLine("Event happens!, {0}", s);
            Console.WriteLine($"{obj.GetType()}");
            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            ClassWithEvent withEvent = new ClassWithEvent();

            withEvent.SomeCustomEvent += WithEventOnSomeCustomEvent;

            object obj = new ClassWithEvent();

            Console.WriteLine($"{obj.GetType()}");
            Console.WriteLine(new StackTrace());
            Console.ReadKey();
        }