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

Add SuccessfulResult static property #14

Merged
merged 5 commits into from
Nov 8, 2023
Merged

Add SuccessfulResult static property #14

merged 5 commits into from
Nov 8, 2023

Conversation

MikyM
Copy link
Contributor

@MikyM MikyM commented Oct 31, 2023

This PR adds a SuccessfulResult static property to Result much like ValueTask's / Task's CompletedTask property with a cached boxed instance of a successful result.

/// The <see cref="Inner"/> property is also set to null.
/// </para>
/// </remarks>
public static IResult SuccessfulResult { get; } = FromSuccess();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd shorten this to Success since it's a static property and it'll always be called with a reference to the Result type.

Consider adding a matching property to the typed result struct as well for symmetry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shortened, added a matching property to the typed result aswell.

Remora.Results/Result.cs Outdated Show resolved Hide resolved
Tests/Remora.Results.Tests/ResultTests.cs Outdated Show resolved Hide resolved
Remora.Results/Result.cs Outdated Show resolved Hide resolved
@MikyM MikyM requested a review from Nihlus November 4, 2023 20:17
Remora.Results/Result.cs Outdated Show resolved Hide resolved
Remora.Results/Result.cs Outdated Show resolved Hide resolved
@MikyM MikyM requested a review from Nihlus November 7, 2023 17:40
@Nihlus Nihlus merged commit 613368f into Remora:main Nov 8, 2023
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants