You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69-10Lines changed: 69 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,73 @@
1
1
# ReactiveUI.SourceGenerators
2
2
Use source generators to generate ReactiveUI objects.
3
3
4
-
Not taking public contributions at this time
4
+
Not taking public contributions at this time
5
+
6
+
These Source Generators were designed to work in full with ReactiveUI V19.5.31 and newer supporting all features, currently:
7
+
-[Reactive]
8
+
-[ObservableAsProperty]
9
+
-[ReactiveCommand]
10
+
11
+
Versions older than V19.5.31 to this:
12
+
-[Reactive] fully supported,
13
+
-[ObservableAsProperty] fully supported,
14
+
-[ReactiveCommand] all supported except Cancellation Token asnyc methods.
15
+
16
+
# Historical ways
17
+
## Read-write properties
18
+
Typically properties are declared like this:
19
+
20
+
```csharp
21
+
privatestring_name;
22
+
publicstringName
23
+
{
24
+
get=>_name;
25
+
set=>this.RaiseAndSetIfChanged(ref_name, value);
26
+
}
27
+
```
28
+
29
+
Before these Source Generators were avaliable we used ReactiveUI.Fody.
30
+
With ReactiveUI.Fody the `[Reactive]` Attribute was placed on a Public Property with Auto get / set properties, the generated code from the Source Generator and the Injected code using Fody are very similar with the exception of the Attributes.
31
+
```csharp
32
+
[Reactive]
33
+
publicstringName { get; set; }
34
+
```
35
+
36
+
## ObservableAsPropertyHelper properties
37
+
Similarly, to declare output properties, the code looks like this:
With ReactiveUI.Fody, you can simply declare a read-only property using the [ObservableAsProperty] attribute, using either option of the two options shown below.
0 commit comments