Search code examples
c#language-ext

LanguageExt.Core Result<T> usage


I have tried to use the Result type in Nuget package LanguageExt.Core for some time now, but feels it is not flexible enough for my needs and expectations for a Result type.

You can use the Match method to check the outcome of a method returning Result, but there is no easy way to fx. use the result as guard and accessing the provided exception if an exception was thrown.

Would appreciate if someone could provide some usage example code or recommend a better package for the Result pattern.


Solution

  • Do not use Result.

    You are probably looking for Either or Fin.

    This question is answered here and here in detail.

    PS: You should not use Try (another candidate in LanguageExt v4) because it will be removed in v5 (next release).