Skip to content

Allow 'yield break' in expression-bodied iterator method #5402

Answered by svick
nillkitty asked this question in Language Ideas
Discussion options

You must be logged in to vote

Why is this needed when you can return Enumerable.Empty<T>() instead? (Though you have to repeat T there.)

Or use a regular statement body, but write it on a single line?

public IEnumerable<IAccessEntry> GetAccessEntries() { yield break; }

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@bernd5
Comment options

@nillkitty
Comment options

@svick
Comment options

@nillkitty
Comment options

@jnm2
Comment options

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