.NET – LINQ with RX extension

I think LINQ query language is suitable for IObservable, just like IEnumerable using 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 IEnumerable version of the code is fine. However, for the LINQ version of Foo (second OK)
I got a late binding not allowed error

x.Item1

When I hover over the x When Intellisense said it is an object type instead of a
type tuple. But the operation of the object query version is the same (first line)
Compile OK. I have imported it

Imports system.reactive.linq

Did I miss another reference?

All the codes in your question apply to me. I did not receive your error.

Maybe try to import System.Reactive, but otherwise it looks good.

I think the LINQ query language is suitable for IObservable, just like IEnumerable using ReactiveExtensions. I have the following code

Public Sub Foo(source As IObservable(Of Tuple(Of Integer, Integer)))< br /> 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 IEnumerable version of the code is fine. However, for the LINQ version of Foo (second line)
I got a late binding not allowed error< /p>

x.Item1

When I hover the mouse over x, Intellisense says it is an object type and not a
type tuple. But The operation of the object query version is the same (the first line)
Compile OK. I have already imported

Import s system.reactive.linq

Did I miss another reference?

All the codes in your question apply to me. I did not receive your error.

Maybe try Import System.Reactive, but other than that it looks good.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 401 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.