CSharpFunctionalExtensions
CSharpFunctionalExtensions copied to clipboard
Extension resolution
This works:
private IObservable<Unit> MyMethod() => MyApi
.DoSomething()
.Select(result => ResultExtensions
.OnSuccess(result, () => { _myVariable = result.Value; })
.OnSuccess(() => NavigationService.GoBack())
.OnFailure(async error => await NavigationService.DisplayAlert(error))
.OnBoth(_ => Unit.Default));
this doesn't:
private IObservable<Unit> MyMethod() => MyApi
.DoSomething()
.Select(result => result
.OnSuccess(() => { _myVariable = result.Value; })
.OnSuccess(() => NavigationService.GoBack())
.OnFailure(async error => await NavigationService.DisplayAlert(error))
.OnBoth(_ => Unit.Default));
On the one that fails, R# complains that the first OnSuccess is missing a return statement;
Note that even on the first version I have to add ugly braces otherwise it thinks my Action is a Func.