You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 emptyIEnumerable
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.The text was updated successfully, but these errors were encountered: