dotnet / dotnet/maui-samples

[ObservableProperty] is not needed for ObservableCollection<T>, right?

Open
#559 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I think `[ObservableProperty]` is not needed for `ObservableCollection`.

https://github.com/dotnet/maui-samples/blob/4d9d1f3834d146a04b749fbf224978107a1e3031/9.0/Beginners-Series/BeginnersTask/ViewModel/MainViewModel.cs#L17

I propose the following:
```cs
public MainViewModel(IConnectivity connectivity)
{
this.connectivity = connectivity;
}
public ObservableCollection Items { get; } = [];
```
instead of
```cs
public MainViewModel(IConnectivity connectivity)
{
Items = [];
this.connectivity = connectivity;
}
[ObservableProperty]
ObservableCollection items;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.