Modify OfType to accept nullable input element type by idg10 · Pull Request #2260 · dotnet/reactive (original) (raw)

@idg10

This enables e.g.

IObservable<string?> s = ...;
IObservable<string> s.OfType<string>()

to filter it down to just the non-null strings.

This is consistent with how System.Linq.Async was changed (and how the .NET runtime library replacement for this, System.Linq.AsyncEnumerable` also works).

This was referenced

Oct 22, 2025

@idg10 idg10 marked this pull request as ready for review

October 22, 2025 13:15

@idg10 idg10 deleted the feature/2247-oftype-nullable-elements branch

October 22, 2025 13:27

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})