What is the way to combine multiple failures when T is different but E is the same? #377
-
I am trying to understand the methods in Result.Combine (CSharpFunctionalExtensions\Result\Methods\Combine.cs) I have an Error class so the Result I use is in the form Result<T,Error>. Example:
Assuming the Error type is Error for all the Create methods, how do I get a collection of Errors? In the tests I saw T is the same but in my case T is different, only Error is the same type. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This is my solution and hopefully there is a better way. I created an ErrorCollection class with an implicit operator to convert error.
Then I can combine the errors as |
Beta Was this translation helpful? Give feedback.
-
Yes, such an |
Beta Was this translation helpful? Give feedback.
This is my solution and hopefully there is a better way.
I created an ErrorCollection class with an implicit operator to convert error.