Is it possible to use ‘foreach’ on the same IEnumerable twice or more inside a method with ‘yield’?
Very simple case: I have a list of items (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
. I need to filter it and drop a few first elements and a few last elements and to get a few items from the middle (for example I need to get (5, 6, 7, 8)
).
Is it possible to use ‘foreach’ on the same IEnumerable twice or more inside a method with ‘yield’?
Very simple case: I have a list of items (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
. I need to filter it and drop a few first elements and a few last elements and to get a few items from the middle (for example I need to get (5, 6, 7, 8)
).