async_enumerable.cs

C#マスター

Explorer

C40
C++40
C#
初級10
中級10
上級10
エキスパート5
マスター5
async_enumerable.cs
channel_pipeline.cs
source_generator.cs
span_memory.cs
pattern_switch.cs
Dart40
Go40
Java40
JavaScript40
Kotlin40
Objective-C40
Perl40
PHP40
Python40
R40
Ruby40
Rust40
Shell40
Swift40
TypeScript40
async_enumerable.cs
Click to focus
1
2
3
4
5
6
7
8
9
10
async IAsyncEnumerable<T> FetchPages<T>(string url, CancellationToken ct = default) {
   int page = 0;
   while (!ct.IsCancellationRequested) {
       var data = await http.GetFromJsonAsync<PagedResult<T>>($"{url}?page={page++}", ct);
       if (!data.Items.Any()) yield break;
       foreach (var item in data.Items) {
           yield return item;
       }
   }
}
0WPM0%0:000/365(0%)|Ln 1, Col 1
UTF-8C#

関連する練習問題