在.NET 3.5接收扩展Threading.Tasks模拟?NET、Tasks、Threading

2023-09-07 02:29:48 作者:伱侢ぬ終究属亍莂亽

是否有可能使用无功扩展(Rx)的创建在.NET 3.5执行并行还是有限的在某些方面的应用?我下载的Rx从这里 http://www.microsoft.com/download/ EN / confirmation.aspx?ID = 26649 ,并创建具有参考反应组件一个简单的项目后,我没能找到相应的任务在.NET 4.0中的所有类。我试图寻找类'任务',但可惜我找不到任何。难道我做错了什么?

Is it possible to use Reactive Extensions (Rx) to create applications in .NET 3.5 that perform parallelization or is it limited in some way? I downloaded Rx from here http://www.microsoft.com/download/en/confirmation.aspx?id=26649 and after creating a simple project with referenced reactive assemblies, I failed to find any classes corresponding to Tasks in .NET 4.0. I'm trying to find classes for 'Task', but alas I can not find any. Am I doing something wrong?

推荐答案

也许从RX维基样品可以帮你。

Maybe the samples from the rx wiki can help you.

最简单的后台任务将是:

The simplest background task would be:

var o = Observable.Start
(
    () => 
    { 
        Console.WriteLine("Calculating..."); 
        Thread.Sleep(3000); 
        Console.WriteLine("Done."); 
    }
);

o.First();   // subscribe and wait for completion of background operation

但你也可能想看看forkjoin例子。

But you may also want to look at the forkjoin examples.