Replies: 3 comments
-
I'm pretty sure it is because OkResult and BadRequestResult can not be implicitly converted to the same type. Try changing your It works in your later example because it is immediately being returned so the return type can be inferred from the function return type which I assume is |
Beta Was this translation helpful? Give feedback.
-
I don't NEED a return type here though; does that mean this isn't appropriate use in this case? This seems to work (no compile time errors)... I don't know well enough to verify if it's ideal or not. The code includes all the work I'm doing at this level so it's a more complete example.
|
Beta Was this translation helpful? Give feedback.
-
Match has an overload that takes an Action. Probably more appropriate for your last example since you don't appear to do anything with the return. |
Beta Was this translation helpful? Give feedback.
-
The below code errors saying the type arguments for the method
Result<Member>.Match<R>(Func<Member, R>, Func<Exception, R>)
can't be inferred from usage.Obviously I'm doing something wrong but based on the video about this from Nick Chapsas, I really can't see WHAT I'm doing wrokg. I don't need this method to even return a type...
In fact, what would suit me best would be something like this:
Why can't I do this?
Nick has his method as...
Doesn't seem any different to my code; success and fail return different types but mine doesn't work...
Beta Was this translation helpful? Give feedback.
All reactions