作者: noah001
查看: 1373|回复: 1

[求助] 关于ContinueWith的使用方法

[复制链接]
noah001 发表于 2019-4-10 12:01:45 | 显示全部楼层 |阅读模式
查看: 1373|回复: 1
有个问题请教各位大佬,task.ContinueWith的后面的方法在声明的时候,是以Task类的对象为参数的,那如果方法自己还有参数,怎么传进去啊?
例如:
        public long sumCal2(Task<long> task, int end, int time)
        {
            for (int i = 1; i <= end; i++)
            {
                 Console.WriteLine(time);
            }
            return sum;
        }


        Task<long> task1 = new Task<long>(() => {...});
        Task<long> task2 = task1.ContinueWith<long>(???);

问号里面怎么写?
回复 论坛版权

使用道具 举报

 楼主| noah001 发表于 2019-4-10 18:33:21 | 显示全部楼层
Task<long> task2 = task1.ContinueWith(t=>sumCal2(t,end,time));
您需要登录后才可以回帖 登录 | 加入CSkin博客

本版积分规则

QQ|申请友链|小黑屋|手机版|Archiver|CSkin ( 粤ICP备13070794号

Powered by Discuz! X3.2  © 2001-2013 Comsenz Inc.  Designed by ARTERY.cn
GMT+8, 2024-3-29 06:42, Processed in 0.576595 second(s), 29 queries , Gzip On.

快速回复 返回顶部 返回列表