Skip to content

Commit aa8d07d

Browse files
Merge branch 'master' into Release-v2.1.0
2 parents b9a6faf + 0cb457a commit aa8d07d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ Inspired by [John Thiriet](https://github.com/johnthiriet)'s blog posts: [Removi
1212
- `WeakEventManager`
1313
- Avoids memory leaks when events are not unsubscribed
1414
- Used by `AsyncCommand` and `AsyncCommand<T>`
15-
- [Usage instructions](#asyncawaitbestpractices)
15+
- [Usage instructions](#asyncawaitbestpractices-2)
1616
- AsyncAwaitBestPractices.MVVM
1717
- Allows for `Task` to safely be used asynchronously with `ICommand`:
1818
- `IAsyncCommand : ICommand`
1919
- `AsyncCommand : IAsyncCommand`
2020
- `IAsyncCommand<T> : ICommand`
2121
- `AsyncCommand<T> : IAsyncCommand<T>`
22-
- [Usage instructions](#asyncawaitbestpracticesmvvm)
22+
- [Usage instructions](#asyncawaitbestpracticesmvvm-1)
2323

2424
## Setup
2525

2626
### AsyncAwaitBestPractices
2727

28-
[![NuGet](https://img.shields.io/nuget/v/AsyncAwaitBestPractices.svg?label=NuGet)](https://www.nuget.org/packages/AsyncAwaitBestPractices/) [![NuGet](https://img.shields.io/nuget/dt/AsyncAwaitBestPractices.svg?label=Downloads)](https://www.nuget.org/packages/AsyncAwaitBestPractices/)
28+
[![NuGet](https://buildstats.info/nuget/AsyncAwaitBestPractices)](https://www.nuget.org/packages/AsyncAwaitBestPractices/)
2929

3030
- Available on NuGet: https://www.nuget.org/packages/AsyncAwaitBestPractices/
3131
- Add to any project supporting .NET Standard 1.0
3232

3333
### AsyncAwaitBestPractices.MVVM
3434

35-
[![NuGet](https://img.shields.io/nuget/v/AsyncAwaitBestPractices.MVVM.svg?label=NuGet)](https://www.nuget.org/packages/AsyncAwaitBestPractices.MVVM/) [![NuGet](https://img.shields.io/nuget/dt/AsyncAwaitBestPractices.MVVM.svg?label=Downloads)](https://www.nuget.org/packages/AsyncAwaitBestPractices.MVVM/)
35+
[![NuGet](https://buildstats.info/nuget/AsyncAwaitBestPractices.MVVM)](https://www.nuget.org/packages/AsyncAwaitBestPractices.MVVM/)
3636

3737
- Available on NuGet: https://www.nuget.org/packages/AsyncAwaitBestPractices.MVVM/
3838
- Add to any project supporting .NET Standard 2.0
@@ -95,10 +95,9 @@ Never, never, never, never, never use `.Result` or `.Wait()`:
9595

9696
## AsyncAwaitBestPractices
9797

98+
### `SafeFireAndForget`
9899
An extension method to safely fire-and-forget a `Task`:
99100

100-
- `SafeFireAndForget`
101-
102101
```csharp
103102
public static async void SafeFireAndForget(this System.Threading.Tasks.Task task, bool continueOnCapturedContext = true, System.Action<System.Exception> onException = null)
104103
```
@@ -120,9 +119,9 @@ async Task ExampleAsyncMethod()
120119
}
121120
```
122121

123-
An event implementation that enables the [garbage collector to collect an object without needing to unsubscribe event handlers](http://paulstovell.com/blog/weakevents), inspired by [Xamarin.Forms.WeakEventManager](https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/WeakEventManager.cs):
122+
### `WeakEventManager`
124123

125-
- `WeakEventManager`
124+
An event implementation that enables the [garbage collector to collect an object without needing to unsubscribe event handlers](http://paulstovell.com/blog/weakevents), inspired by [Xamarin.Forms.WeakEventManager](https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/WeakEventManager.cs):
126125

127126
```csharp
128127
readonly WeakEventManager _weakEventManager = new WeakEventManager();
@@ -136,7 +135,7 @@ public event EventHandler CanExecuteChanged
136135
public void RaiseCanExecuteChanged() => _weakEventManager.HandleEvent(this, EventArgs.Empty, nameof(CanExecuteChanged));
137136
```
138137

139-
- `WeakEventManager<T>`
138+
### `WeakEventManager<T>`
140139

141140
```csharp
142141
readonly WeakEventManager<string> _errorOcurredEventManager = new WeakEventManager<string>();
@@ -152,9 +151,12 @@ public void RaiseErrorOcurred(string message) => _weakEventManager.HandleEvent(t
152151

153152
## AsyncAwaitBestPractices.MVVM
154153

154+
### `AsyncCommand`
155+
155156
Allows for `Task` to safely be used asynchronously with `ICommand`:
156157

157-
- `AsyncCommand<T> : IAsyncCommand`
158+
- `AsyncCommand<T> : IAsyncCommand<T>`
159+
- `IAsyncCommand<T> : ICommand`
158160
- `AsyncCommand : IAsyncCommand`
159161
- `IAsyncCommand : ICommand`
160162

0 commit comments

Comments
 (0)