Error Cannot convert lambda expression in subscribe for an IObservable<Point>
The namespace System.Reactive.Linq
contains the static class Observable
which defines all the extension methods for common reactive combinators. It resides in System.Reactive.dll
The extension methods for IObservable<T>.Subscribe
such as Subscribe(onNext)
, Subscribe(onNext, onError)
are however defined in mscorlib
in the static class System.ObservableExtensions
.
tl;dr:
- For Rx/Observable extension methods you need to import
System.Reactive.Linq
=using System.Reactive.Linq;
- For Subscribe overloads you need to import
System
=using System;
To make this a clearer answer based on @Gideon Engelberths comment 5th down in the question I was missing the 'using System;' using directive in my class:
using System.Reactive.Linq;
using System;
Which then fixed up the compiler issue. Thanks Gideon.