Beispiel #1
0
        static void Main(string[] args)
        {
            ExampleObject.MyCallbackHandler cb;

            // anonymous delegate
            cb = delegate(object callbackData)
            {
                Console.WriteLine(callbackData);
            };

            var o = new ExampleObject();
            o.Invoke(delegate(object callbackData)
            {
                Console.WriteLine(callbackData);
            });

            // Lambda expression implementation.
            o.Invoke(d => Console.WriteLine(d));

            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            ExampleObject.MyCallbackHandler cb;

            // anonymous delegate
            cb = delegate(object callbackData)
            {
                Console.WriteLine(callbackData);
            };

            var o = new ExampleObject();

            o.Invoke(delegate(object callbackData)
            {
                Console.WriteLine(callbackData);
            });

            // Lambda expression implementation.
            o.Invoke(d => Console.WriteLine(d));

            Console.ReadLine();
        }