Skip to content

Result-Pattern example with implicit conversion and Match function.

Notifications You must be signed in to change notification settings

reiugit/ResultPatternExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Result-Pattern Example

  • Implicit conversion of Values and Errors to 'Result' objects:
  public static implicit operator Result(TValue value) => new(value);
  public static implicit operator Result(Error error) => new(error);
  • 'Match' function for handling the Result object:
  public TResult Match(
      Func success,
      Func failure)
  {
      return _isSuccess
          ? success(_value!)
          : failure(_error);
  }

About

Result-Pattern example with implicit conversion and Match function.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages