是否有.Net等效于java.util.concurrent.Executor? [英] Is there a .Net equivalent to java.util.concurrent.Executor?

查看:155
本文介绍了是否有.Net等效于java.util.concurrent.Executor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一组长时间运行的离散任务:从文本文件解析成千上万行,水化成对象,操作和持久化。

Have a long running set of discrete tasks: parsing 10s of thousands of lines from a text file, hydrating into objects, manipulating, and persisting.

如果我在Java中实现这一点,我想我可以为每个X行(即块)文件或任务中的每一行添加一个新任务到执行者。

If I were implementing this in Java, I suppose I might add a new task to an Executor for each line in the file or task per X lines (i.e. chunks).

对于.Net,这是我正在使用的,我不太确定。我有一个怀疑可能CCR可能适合这里,但我不熟悉它,这就是为什么我提出这个问题。

For .Net, which is what I am using, I'm not so sure. I have a suspicion maybe CCR might be appropriate here, but I'm not familiar enough with it, which is why I pose this question.

推荐答案

您可能需要查看任务并行库

从C#5开始,使用 async code> await 关键字。

As of C# 5 this is built into the language using the async and await keywords.

这篇关于是否有.Net等效于java.util.concurrent.Executor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆