From 5cc97c7f0085624b6ef57853d70b404440060cef Mon Sep 17 00:00:00 2001 From: Yoshifumi Kawai <46207+neuecc@users.noreply.github.com> Date: Thu, 2 Nov 2023 18:23:43 +0900 Subject: [PATCH] ReadMe --- README.md | 6 +++--- README_CN.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d1cacac..ae311c5 100644 --- a/README.md +++ b/README.md @@ -700,7 +700,7 @@ Unity 2020.2 supports C# 8.0 so you can use `await foreach`. This is the new Upd ```csharp // Unity 2020.2, C# 8.0 -await foreach (var _ in UniTaskAsyncEnumerable.EveryUpdate(token)) +await foreach (var _ in UniTaskAsyncEnumerable.EveryUpdate().WithCancellation(token)) { Debug.Log("Update() " + Time.frameCount); } @@ -710,10 +710,10 @@ In a C# 7.3 environment, you can use the `ForEachAsync` method to work in almost ```csharp // C# 7.3(Unity 2018.3~) -await UniTaskAsyncEnumerable.EveryUpdate(token).ForEachAsync(_ => +await UniTaskAsyncEnumerable.EveryUpdate().ForEachAsync(_ => { Debug.Log("Update() " + Time.frameCount); -}); +}, token); ``` UniTaskAsyncEnumerable implements asynchronous LINQ, similar to LINQ in `IEnumerable` or Rx in `IObservable`. All standard LINQ query operators can be applied to asynchronous streams. For example, the following code shows how to apply a Where filter to a button-click asynchronous stream that runs once every two clicks. diff --git a/README_CN.md b/README_CN.md index d91d68d..fc12fbe 100644 --- a/README_CN.md +++ b/README_CN.md @@ -685,7 +685,7 @@ Unity 2020.2 支持 C# 8.0,因此您可以使用`await foreach`. 这是异步 ```csharp // Unity 2020.2, C# 8.0 -await foreach (var _ in UniTaskAsyncEnumerable.EveryUpdate(token)) +await foreach (var _ in UniTaskAsyncEnumerable.EveryUpdate().WithCancellation(token)) { Debug.Log("Update() " + Time.frameCount); } @@ -695,10 +695,10 @@ await foreach (var _ in UniTaskAsyncEnumerable.EveryUpdate(token)) ```csharp // C# 7.3(Unity 2018.3~) -await UniTaskAsyncEnumerable.EveryUpdate(token).ForEachAsync(_ => +await UniTaskAsyncEnumerable.EveryUpdate().ForEachAsync(_ => { Debug.Log("Update() " + Time.frameCount); -}); +}, token); ``` UniTaskAsyncEnumerable 实现异步 LINQ,类似于 LINQ 的`IEnumerable`或 Rx 的 `IObservable`。所有标准 LINQ 查询运算符都可以应用于异步流。例如,以下代码表示如何将 Where 过滤器应用于每两次单击运行一次的按钮单击异步流。