@@ -43,22 +43,6 @@ public bool MoveNext()
43
43
}
44
44
}
45
45
46
- [ Serializable ]
47
- private class EmtpyAsyncEnumerator < T > : IAsyncEnumerator < T >
48
- {
49
- public T Current => throw new InvalidOperationException ( "EmtpyAsyncEnumerator.get_Current" ) ;
50
-
51
- public ValueTask DisposeAsync ( )
52
- {
53
- return default ;
54
- }
55
-
56
- public ValueTask < bool > MoveNextAsync ( )
57
- {
58
- return new ValueTask < bool > ( false ) ;
59
- }
60
- }
61
-
62
46
private class EmptyEnumerableClass : IEnumerable
63
47
{
64
48
public IEnumerator GetEnumerator ( )
@@ -67,14 +51,6 @@ public IEnumerator GetEnumerator()
67
51
}
68
52
}
69
53
70
- private class EmptyAsyncEnumerableClass : IAsyncEnumerable < object >
71
- {
72
- public IAsyncEnumerator < object > GetAsyncEnumerator ( CancellationToken cancellationToken = default )
73
- {
74
- return new EmtpyAsyncEnumerator < object > ( ) ;
75
- }
76
- }
77
-
78
54
/// <summary>
79
55
/// A read-only dictionary that is always empty and permits lookup by <see langword="null" /> key.
80
56
/// </summary>
@@ -240,7 +216,6 @@ public IEnumerator GetEnumerator()
240
216
}
241
217
242
218
public static readonly IEnumerable EmptyEnumerable = new EmptyEnumerableClass ( ) ;
243
- public static readonly IAsyncEnumerable < object > EmptyAsyncEnumerable = new EmptyAsyncEnumerableClass ( ) ;
244
219
public static readonly IDictionary EmptyMap = new EmptyMapClass ( ) ;
245
220
246
221
public static IDictionary < TKey , TValue > EmptyDictionary < TKey , TValue > ( )
@@ -454,11 +429,23 @@ public IEnumerator GetEnumerator()
454
429
}
455
430
456
431
[ Serializable ]
457
- internal class EmptyAsyncEnumerableClass < T > : IAsyncEnumerable < T >
432
+ internal class EmptyAsyncEnumerable < T > : IAsyncEnumerable < T > , IAsyncEnumerator < T >
458
433
{
434
+ public T Current => throw new InvalidOperationException ( "EmtpyAsyncEnumerator.get_Current" ) ;
435
+
436
+ public ValueTask DisposeAsync ( )
437
+ {
438
+ return default ;
439
+ }
440
+
441
+ public ValueTask < bool > MoveNextAsync ( )
442
+ {
443
+ return new ValueTask < bool > ( false ) ;
444
+ }
445
+
459
446
public IAsyncEnumerator < T > GetAsyncEnumerator ( CancellationToken cancellationToken = default )
460
447
{
461
- return new EmtpyAsyncEnumerator < T > ( ) ;
448
+ return this ;
462
449
}
463
450
}
464
451
0 commit comments