dotnet
dotnet copied to clipboard
Consider forwarding `MemberNotNull` and `MemberNotNullWhen` for observable properties
Overview
Today, MemberNotNull and MemberNotNullWhen attributes are not forwarded from backing fields to observable properties. This would be useful for observable properties that indicate that other properties are valid to access.
API breakdown
No new APIs need to be added.
Usage example
[ObservableProperty, MemberNotNullWhen(true, nameof(Value))]
private bool isValid;
[ObservableProperty]
private string? value;
Would generate two properties, IsValid and Value, and IsValid would have the MemberNotNullWhen attribute applied to it.
Breaking change?
No
Alternatives
None.
Additional context
No response
Help us help you
No, just wanted to propose this