Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 224
Drake Avatar asked Dec 20 '25 19:12

Drake


1 Answers

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

You need to import the namespace first.

like image 122
SLaks Avatar answered Dec 22 '25 07:12

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!