LINQ with RX Extensions

I got the impression that the LINQ query language worked for IObservable, as well as for IEnumerable with ReactiveExtensions. I have the following code

Public Sub Foo(source As IObservable(Of Tuple(Of Integer, Integer))) Dim filtered = source.Where(Function(x) x.Item1 > 10).Select(Function(x) x.Item1 + x.Item2) Dim filtered2 = From x In source Where x.Item1 > 10 Select x.Item1 + x.Item2 End Sub Public Sub Bar(source As IEnumerable(Of Tuple(Of Integer, Integer))) Dim filtered = source.Where(Function(x) x.Item1 > 10).Select(Function(x) x.Item1 + x.Item2) Dim filtered2 = From x In source Where x.Item1 > 10 Select x.Item1 + x.Item2 End Sub 

The code for the IEnumerable version is fine. However, for the LINQ version of Foo (second line) I get a later binding forbidden on

 x.Item1 

When I am above x , Intellisense says it is a type object, not a tuple type. However, the request version of the object of the same operation (first line) compiles normally. I have imported

 Imports system.reactive.linq 

Did I miss another link?

+4
source share
1 answer

All your code in question is great for me. I do not get your error.

Maybe try importing System.Reactive too, but also, it looks fine.

+1
source

Source: https://habr.com/ru/post/1443659/


All Articles