Skip to content

Allow yield when return type is any implementer of IEnumerable #8344

Discussion options

You must be logged in to vote
List<int> MyMethod()
{
    return [..Inner()];

    static IEnumerable<int> Inner()
    {
        // Yield as much as you want here.
    }
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@seanblue
Comment options

Answer selected by seanblue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants