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

Inconsistent Exception Behavior in Gradient #94

Open
Chris3606 opened this issue Jan 15, 2023 · 0 comments
Open

Inconsistent Exception Behavior in Gradient #94

Chris3606 opened this issue Jan 15, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@Chris3606
Copy link
Contributor

Chris3606 commented Jan 15, 2023

Currently, var gradient = new Gradient() will produce an exception. Arguably, this makes sense since an empty gradient doesn't really represent anything; but it is possible to create an empty gradient by passing two empty IEnumerable object to the constructor with 2 parameters.

The behavior between these two should, I think, be consistent. If it doesn't make sense to allow an empty Gradient, then disallow it in all constructors. If it does make sense, enable it as applicable in all constructors.

Additionally, it is possible to construct a 1-color Gradient, but only using the constructor with 2 parameters (like var gradient = new Gradient(new[]{Color.Aqua}, new[] {0f}). The one that can take only a single color will turn it into 2 colors. This is also a case where consistency would be of benefit.

@Chris3606 Chris3606 added the bug Something isn't working label Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant