Fork me on GitHub

并行执行,没用到过,写到这里免得搞忘

 /// <summary>
    /// 
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            simultaneous();
            Console.ReadKey();
        }

        static void simultaneous()
        {
            //尽可能并行执行提供的每个操作
            Parallel.Invoke(
            () => ComplexMethod("1"),
            () => ComplexMethod("2"),
            () => ComplexMethod("3")
            );
        }
        static void ComplexMethod(string a)
        {
            Console.WriteLine(a);
        }
    }

 

posted @ 2016-12-12 10:20  Something_Diffrent  阅读(175)  评论(0)    收藏  举报