Gu.Reactive
Gu.Reactive copied to clipboard
AsReadonlyView extension method
var view = foo.ObserveValue(x => x.Items).AsReadOnlyView();
Workaround 1:
var view = foo.ObserveValue(x => x.Items)
.Select(x => x.GetValueOrDefault())
.AsReadOnlyView()
Workaround 2:
var view = foo.ObserveValue(x => x.Items)
.Select(x => (IMaybe<int[]>)x)
.AsReadOnlyView()
We can add ObserveEnumerableValue() that returns IMaybe<IEnumerable<T>> but not sure it is worth it.
Another alternative is to generate overloads for common collection types but it will not work for immutable collections which is a common use case.
Not doing anything with this, chances are shapes will solve it in the future.