Skip to content

Commit 0948efd

Browse files
authored
Add ReactiveCollection to the Readme (#273)
1 parent d8980a4 commit 0948efd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ReactiveUI Source Generators automatically generate ReactiveUI objects to stream
4141
- `[RoutedControlHost("YourNameSpace.CustomControl")]`
4242
- `[ViewModelControlHost("YourNameSpace.CustomControl")]`
4343
- `[BindableDerivedList]` Generates a derived list from a ReadOnlyObservableCollection backing field
44+
- `[ReactiveCollection]` Generates property changed notifications on add, remove, new actions on a ObservableCollection backing field
4445

4546
### Compatibility Notes
4647
- For ReactiveUI versions **older than V19.5.31**, all `[ReactiveCommand]` options are supported except for async methods with a `CancellationToken`.
@@ -587,6 +588,24 @@ using ReactiveUI.SourceGenerators.WinForms;
587588
public partial class MyCustomViewModelControlHost;
588589
```
589590

591+
### ReactiveCollection
592+
```csharp
593+
using System.Collections.ObjectModel;
594+
using ReactiveUI;
595+
using ReactiveUI.SourceGenerators;
596+
597+
public partial class MyReactiveClass : ReactiveObject
598+
{
599+
[ReactiveCollection]
600+
private ObservableCollection<string> _myCollection;
601+
602+
public MyReactiveClass()
603+
{
604+
MyCollection = new ObservableCollection<string>();
605+
_myCollection.Add("Item 1");
606+
}
607+
}
608+
```
590609

591610
### TODO:
592611
- Add ObservableAsProperty to generate from a IObservable method with parameters.

0 commit comments

Comments
 (0)