CommunityToolkit / CommunityToolkit/dotnet

Generate observable properties based on nested record

Open
#207 3 comments 0 reactions 0 assignees View on GitHub
feature request :mailbox_with_mail: mvvm-toolkit :toolbox: needs triage :mag:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

One disadvantage that I see with the classic observable pattern implementation is that the backing fields are accessible and visible in the intellisense even if nobody should access them directly. Have you considered to generate the observable properties based on a different input than the backin fields (e. g. a nested record)

example:
```csharp

class MyObsevablePerson
{
[ObservableFields]
private record Fields(string FirstName, string LastName);
}
```
would generate
```csharp
class MyObsevablePerson
{
private Fields _fields =new();

public string FirstName
{
get=> _fields.FirstName;
set ....
}

....

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.