4

I was under the impression that the LINQ query language worked for IObservable as it does for IEnumerable with the 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 OK. However for the LINQ version of Foo ( second line ) I get a late binding disallowed error on

x.Item1

When I hover over x the Intellisense says it is of type object instead of type tuple. However the object query version of the same operation ( first line ) compiles ok. I've imported

Imports system.reactive.linq

Am I missing another reference?

1 Answer 1

1

All of your code in the question works fine for me. I don't get your error.

Perhaps try importing System.Reactive too, but other than that it looks fine.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.