-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
API Proposal: ECPoint.IsEmpty #34459
Comments
I couldn't figure out the best area label to add to this issue. Please help me learn by adding exactly one area label. |
The [MemberNotNullWhen(false, nameof(X))]
[MemberNotNullWhen(false, nameof(Y))] For CLS compliance. |
I feel like a |
@bartonjs I never remember that C# feature exists. Amended. (It seems to work fine with an expression-bodied property). |
@bartonjs Actually, I'm not sure this proposal as-is is nullable friendly. Consider: [MemberNotNullWhen(false, nameof(X), nameof(Y))]
public readonly bool IsEmpty => X == null && Y == null; This is incorrect because Perhaps a better way to do this is to make the property [MemberNotNullWhen(true, nameof(X), nameof(Y))]
public readonly bool IsNotEmpty => X != null && Y != null; |
Seems like maybe that's Something like Validate() is OK, except that given that the whole point is that Q is now effectively optional that it's weird that Validate() returning false is sometimes valid. So perhaps it's just best off as it is. |
Perhaps the name [MemberNotNullWhen(true, nameof(X), nameof(Y))]
public readonly bool HasPoint => X != null && Y != null; "Point" conveys that both X and Y are there (since you cannot have a point with either just X or Y). |
@stephentoub Do you have thoughts here? |
This was a small nice-to-have, but I don't think this is worth pursuing given that it's not entirely straight-forward as initially thought. |
Proposal:
Since the intention of PR #33874 is to allow
ECParameters
to have an emptyQ
, this would be a nice addition to allow!Q.IsEmpty
instead of writingQ.X != null && Q.Y != null
all over the place.The text was updated successfully, but these errors were encountered: