Skip to content

Consider allowing Match* operators to attempt to process object #62

@bruno-f-cruz

Description

@bruno-f-cruz

@$"return System.Reactive.Linq.Observable.Create<{genericTypeParameter.Name}>(observer =>
{{
var sourceObserver = System.Reactive.Observer.Create<{ModelType.TypeName}>(
value =>
{{
var match = value as {genericTypeParameter.Name};
if (match != null) observer.OnNext(match);
}},
observer.OnError,
observer.OnCompleted);
return System.ObservableExtensions.SubscribeSafe(source, sourceObserver);
}})"))

Currently constrains the input of the operator to the expected base type.

In some cases, the ability to operate on "object" may be interesting. For instance, since casting to object is supported via ExpressionTransform, it is possible to "Merge" two distinct base classes into the same sequence and dynamically Match their children downstream:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions