dotnet icon indicating copy to clipboard operation
dotnet copied to clipboard

Consider forwarding `MemberNotNull` and `MemberNotNullWhen` for observable properties

Open 333fred opened this issue 3 years ago • 0 comments

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

333fred avatar Aug 05 '22 21:08 333fred