AsyncEnumerator icon indicating copy to clipboard operation
AsyncEnumerator copied to clipboard

Defining an empty enumerator is broken

Open CatoLeanTruetschel opened this issue 6 years ago • 0 comments

Defining an empty enumerator

private static async AsyncEnumerator<int> GetEmptyEnumerator()
{
    var yield = await AsyncEnumerator<int>.Capture();

    return yield.Break();
}

yields the enumerators MoveNext method to return true on the first access while the Current property contains the default value of the type iterated (null for reference types).

CatoLeanTruetschel avatar Jun 21 '18 12:06 CatoLeanTruetschel