Reactive Extension(Rx)教程是最新的

时间:2021-04-02 20:17:47

I am quite interested in Reactive Extensions but I cannot find an up to date tutorial. I started with Curing the asynchronous blues with the Reactive Extensions for .NET but it is out of date. I can figure out some changes but I could not get many examples working.

我对Reactive Extensions很感兴趣但我找不到最新的教程。我开始使用Reactive Extensions for .NET来固化异步蓝调,但它已经过时了。我可以找出一些变化,但我无法得到很多例子。

I found many articles on the web, mainly from 2009,2010 but they are also incompatible with the current release. I am especially interested in using Rx with Windows Phone and WebClient:

我在网上发现了很多文章,主要来自2009,2010,但它们也与当前版本不兼容。我对使用Windows Phone和WebClient的Rx特别感兴趣:

WebClient wc = new WebClient();

var o = Observable.FromEvent<DownloadStringCompletedEventArgs>(wc, "DownloadStringCompleted").Select(newString => newString.EventArgs.Result);

// Subscribe to the observable, and set the label text
o.Subscribe(s => myLabel.Text = s);

// Start the download
wc.DownloadStringAsync(new Uri("http://www.data.com/service"));

Do not work anymore and replacing FromEvent with FromEventPattern is not enough.

不再工作了,用FromEventPattern替换FromEvent是不够的。

Can somebody point me to an up to date resource?

有人能指出我最新的资源吗?

4 个解决方案

#1


46  

When learning Rx the first thing is to understand the philosophy behind IObservable and how it's push based nature compares with IEnumerable. I suggest the following one for a good explanation: A[nother] Simpler Tutorial for Reactive Extensions

在学习Rx时,首先要了解IObservable背后的理念以及它基于推送的性质与IEnumerable的比较。我建议使用以下内容作为一个很好的解释:A [nother] Simpler Tutorial for Reactive Extensions

Lee Campbell has nice series explaining the api and when to use them. He also tries to keep it up to date with latest releases: Reactive Extensions for .NET an Introduction The series is now available as a book at Introduction to Rx

Lee Campbell有很好的系列解释api以及何时使用它们。他还尝试使用最新版本保持最新版本:.NET的反应性扩展简介该系列现在可以作为Rx简介中的一本书出版。

By the way, I have also written a blog post about solving real life problem with rx: Using Reactive Extensions for Streaming Data from Database

顺便说一句,我还写了一篇关于用rx解决现实生活问题的博客文章:使用Reactive Extensions来传输来自数据库的数据

Hope this helps.

希望这可以帮助。

#2


19  

I found a "learn by doing" project called Reactive Extensions (Rx) Koans.
It was last updated in March 2012, so it's fairly up-to-date.

我找到了一个名为Reactive Extensions(Rx)Koans的“边做边学”项目。它最后更新于2012年3月,所以它是最新的。

Definition of ‘Koan’   Kōans is a zen word meaning the enlightenment or awakening of a person, usually through a puzzle or riddle. The most common one is “What is the sound of one hand clapping?”

'Koan'Kōans的定义是一个禅词,意思是一个人的启蒙或觉醒,通常是通过拼图或谜语。最常见的是“单手拍手的声音是什么?”

It is made of a series of almost-complete unit tests that you must finish in such a way that they pass. You do this by 'filling in the blanks'.

它由一系列几乎完整的单元测试组成,您必须以它们通过的方式完成。你通过“填空”来做到这一点。

It's pretty neat, quite easy to complete, and gives valuable insight.

它非常整洁,很容易完成,并提供有价值的见解。

Oh yeah, and it's made by Bart De Smet from the Rx team.

哦,是的,它是由Rx团队的Bart De Smet制作的。

Here's a typical unit test:

这是一个典型的单元测试:

[TestMethod]
public void DoingInTheMiddle()
{
    var status = new List<String>();
    var daysTillTest = Range.Create(4, 1).ToObservable();
    daysTillTest.Do(d => status.Add(d + "=" + (d == 1 ? "Study Like Mad" : ___)))
                .Subscribe();
    Assert.AreEqual("[4=Party, 3=Party, 2=Party, 1=Study Like Mad]", status.AsString());
}

#3


13  

By far the best resource that helped me wrap my head around Rx is: http://www.introtorx.com/

到目前为止,帮助我绕过Rx的最佳资源是:http://www.introtorx.com/

I'm thinking this happens to a lot of people, but you can't find that site when searching on the keywords "Rx tutorial". Think somebody needs to add some tags to the site!

我认为这种情况发生在很多人身上,但在搜索关键字“Rx教程”时找不到该网站。认为有人需要在网站上添加一些标签!

#4


4  

Read this online book line by line (every line) and practice. This is good, I did when I started with Rx.

逐行阅读这本在线书籍(每一行)并练习。这很好,我在开始使用Rx时就做到了。

http://www.introtorx.com/

http://www.introtorx.com/

#1


46  

When learning Rx the first thing is to understand the philosophy behind IObservable and how it's push based nature compares with IEnumerable. I suggest the following one for a good explanation: A[nother] Simpler Tutorial for Reactive Extensions

在学习Rx时,首先要了解IObservable背后的理念以及它基于推送的性质与IEnumerable的比较。我建议使用以下内容作为一个很好的解释:A [nother] Simpler Tutorial for Reactive Extensions

Lee Campbell has nice series explaining the api and when to use them. He also tries to keep it up to date with latest releases: Reactive Extensions for .NET an Introduction The series is now available as a book at Introduction to Rx

Lee Campbell有很好的系列解释api以及何时使用它们。他还尝试使用最新版本保持最新版本:.NET的反应性扩展简介该系列现在可以作为Rx简介中的一本书出版。

By the way, I have also written a blog post about solving real life problem with rx: Using Reactive Extensions for Streaming Data from Database

顺便说一句,我还写了一篇关于用rx解决现实生活问题的博客文章:使用Reactive Extensions来传输来自数据库的数据

Hope this helps.

希望这可以帮助。

#2


19  

I found a "learn by doing" project called Reactive Extensions (Rx) Koans.
It was last updated in March 2012, so it's fairly up-to-date.

我找到了一个名为Reactive Extensions(Rx)Koans的“边做边学”项目。它最后更新于2012年3月,所以它是最新的。

Definition of ‘Koan’   Kōans is a zen word meaning the enlightenment or awakening of a person, usually through a puzzle or riddle. The most common one is “What is the sound of one hand clapping?”

'Koan'Kōans的定义是一个禅词,意思是一个人的启蒙或觉醒,通常是通过拼图或谜语。最常见的是“单手拍手的声音是什么?”

It is made of a series of almost-complete unit tests that you must finish in such a way that they pass. You do this by 'filling in the blanks'.

它由一系列几乎完整的单元测试组成,您必须以它们通过的方式完成。你通过“填空”来做到这一点。

It's pretty neat, quite easy to complete, and gives valuable insight.

它非常整洁,很容易完成,并提供有价值的见解。

Oh yeah, and it's made by Bart De Smet from the Rx team.

哦,是的,它是由Rx团队的Bart De Smet制作的。

Here's a typical unit test:

这是一个典型的单元测试:

[TestMethod]
public void DoingInTheMiddle()
{
    var status = new List<String>();
    var daysTillTest = Range.Create(4, 1).ToObservable();
    daysTillTest.Do(d => status.Add(d + "=" + (d == 1 ? "Study Like Mad" : ___)))
                .Subscribe();
    Assert.AreEqual("[4=Party, 3=Party, 2=Party, 1=Study Like Mad]", status.AsString());
}

#3


13  

By far the best resource that helped me wrap my head around Rx is: http://www.introtorx.com/

到目前为止,帮助我绕过Rx的最佳资源是:http://www.introtorx.com/

I'm thinking this happens to a lot of people, but you can't find that site when searching on the keywords "Rx tutorial". Think somebody needs to add some tags to the site!

我认为这种情况发生在很多人身上,但在搜索关键字“Rx教程”时找不到该网站。认为有人需要在网站上添加一些标签!

#4


4  

Read this online book line by line (every line) and practice. This is good, I did when I started with Rx.

逐行阅读这本在线书籍(每一行)并练习。这很好,我在开始使用Rx时就做到了。

http://www.introtorx.com/

http://www.introtorx.com/