Using the result class in C#

What is the Result class?

Why use it?

How to implement it

Example 1 the non-generic class
Example 2 the generic class

How to use it

Example 3 returning an instance of Result class

In the second example below I check if the result is successful else I display the error.

Example 4 reading the value from the Result class

The main advantage you have with this approach is that you have consistency in communication between your presentation layer, in this case, a WPF application and your business layer.

Wrapping up



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store