Drake
Drake

Reputation: 2703

Rx Task ToObservable() not found

I'm using Visual Studio 2013 with .NET framework version 4.5.1

I am reading tutorials on Reactive Extensions, and am trying to run this code:

var t = Task.Factory.StartNew(() => "Test");
var source = t.ToObservable();

t.ToObservable() is underlined and gives me the error

System.Threading.Tasks.Task<.string> does not contain definition for ToObservable...

I read in another post that I should download Silverlight Toolkit and include the System.Reactive.dll it comes with as a reference, but that did not help.

What should I do to fix this?

Upvotes: 2

Views: 928

Answers (1)

SLaks
SLaks

Reputation: 887275

That extension method is defined in the System.Reactive.Threading.Tasks namespace.

You need to import the namespace first.

Upvotes: 9

Related Questions