Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Result types #27

Open
3 tasks
FelixCCWork opened this issue Jun 12, 2024 · 1 comment
Open
3 tasks

Improve Result types #27

FelixCCWork opened this issue Jun 12, 2024 · 1 comment

Comments

@FelixCCWork
Copy link
Contributor

FelixCCWork commented Jun 12, 2024

  • Make Result to Result conversion explicit, to prevent loosing of information. Check if we can add a .ToResult convertion method.

    public static implicit operator Result(Result<T> result)

  • Check if we want to add auto deconstruct like var (isOk, value) = UpdateDb(entity);

  • Check if we can add a Result variant without error message as most of the time we return a message but never use it. Instead we should log the message where the error happened. For cases where we want to return a message it would be better to have a Result<TValue, TErrorEnum> where TErrorEnum must be a enum describing the type of error. For that type a message might make more sense. For simple cases check if the old if (!TryParse("test", out Guid? id)) makes more sense

@Felix-CodingClimber Felix-CodingClimber changed the title Make Result<T> to Result conversion explicit, to prevent loosing of information. Improve Result types Jul 12, 2024
@FelixCCWork
Copy link
Contributor Author

Have a look at the new discriminated union proposal for .NET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant