コード例 #1
0
ファイル: Program.cs プロジェクト: xs2ranjeet/13ns9-1spr
        static void Main()
        {
            AsyncDemo ad = new AsyncDemo();

            AsyncMethodCaller caller = new AsyncMethodCaller(ad.TestMethod);

            int dummy = 0;

            IAsyncResult result = caller.BeginInvoke(3000,
                out dummy,
                new AsyncCallback(CallbackMethod),
                "The call executed on thread {0}, with return value \"{1}\".");

            Console.WriteLine("The main thread {0} continues to execute...",
                Thread.CurrentThread.ManagedThreadId);

            Thread.Sleep(4000);

            Console.WriteLine("The main thread ends.");

            Console.ReadKey(true);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: mkbiltek2019/Lesons_SAG
        static void Main()
        {
            AsyncDemo ad = new AsyncDemo();

            AsyncMethodCaller caller = new AsyncMethodCaller(ad.TestMethod);

            int dummy = 0;

            IAsyncResult result = caller.BeginInvoke(3000,
                                                     out dummy,
                                                     new AsyncCallback(CallbackMethod),
                                                     "The call executed on thread {0}, with return value \"{1}\".");

            Console.WriteLine("The main thread {0} continues to execute...",
                              Thread.CurrentThread.ManagedThreadId);

            Thread.Sleep(4000);

            Console.WriteLine("The main thread ends.");

            Console.ReadKey(true);
        }