异步--记录

public long Demo(long val)
        {
            return Task.Factory.StartNew(() => {
                long a = 0;

                for (int i = 0; i < val; i++)
                {
                    a += i;
                }

                return a;
            }).ContinueWith<long>(t => {
                return t.Result;
            }).Result;
        }

  

posted @ 2019-04-26 17:13  我要找到我的全世界  阅读(123)  评论(0编辑  收藏  举报