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

Extensive null checks #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kebrok and others added 3 commits November 20, 2024 01:13
…vate ErrorOr(List<Error> errors)

private ErrorOr(List<Error> errors)
{
	if (errors is null)
	{
		throw new ArgumentNullException(nameof(errors));
	}

	if (errors is null || errors.Count == 0)
	{
		throw new ArgumentException("Cannot create an ErrorOr<TValue> from an empty collection of errors. Provide at least one error.", nameof(errors));
	}

	_errors = errors;
}

This check is unnecessary due to the one performed just above.
@zbyszekprasak zbyszekprasak added the optimization Something can run faster or consume less resources label Dec 3, 2024
@zbyszekprasak zbyszekprasak changed the title Optimization: extensive null checks Extensive null checks Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Something can run faster or consume less resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants