-
-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
Hi,
I was wondering why there is no common base class or something like it, that allows one to use all similar functionalities of Result and Result.
I would like to do something like this:
public static T2 DoIfSuccess<T1, T2>(T1 input, Func function)
where T1 : IResultBase
where T2 : IResultBase
{
if (input.IsFailed) return input.ToResult();
var output = function();
return output.IsSuccess
? output
: input.ToResult();
}
It seems not to be possible at the moment, because T1 and T2 can not be converted into one another, but it should be possible in case of Result.Fail, because I don't need the value here.
Am I missing something? Why is this not possible currently and should it be possible?
Metadata
Metadata
Assignees
Labels
No labels