ardalis / Result

A result abstraction that can be mapped to HTTP response codes if needed.
MIT License
866 stars 107 forks source link

Consider adding an implicit cast from T to Result<T> #25

Closed Eirenarch closed 4 years ago

Eirenarch commented 4 years ago

Consider adding an implicit cast from T to Result with an OK status. Since pretty much every use case involves the OK code it would be beneficial to be able to reduce the boilerplate code by simply returning the T value instead of using the Result constructor or the Success static method. There is the potential confusion of someone returning errors as a OK result because they didn't realize how the implicit cast works but that will probably be detected immediately and the user will be able to adapt.