|
@$"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:

sgen/src/Bonsai.Sgen/CSharpTypeMatchTemplate.cs
Lines 76 to 87 in fbf470d
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
objectis supported viaExpressionTransform, it is possible to "Merge" two distinct base classes into the same sequence and dynamically Match their children downstream: