Skip to content

Commit 0b2154f

Browse files
authored
Advise against non-yield solutions (#2336)
As the Accumulate method is supposed to be lazy, the mentors should advise against solutions that don't use the yield keyword
1 parent 838fe92 commit 0b2154f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tracks/csharp/exercises/accumulate/mentoring.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public static class AccumulateExtensions
2222

2323
### Storing the results in an intermediate list
2424

25+
Solutions that don't use the `yield` keyword such as the following one which stores the results in an intermediate list *don't* pass the laziness test. The accumulate execution must be deferred until `ToList()` is called on it, which is tested with the `Accumulate_is_lazy` method.
26+
2527
```csharp
2628
using System;
2729
using System.Collections.Generic;

0 commit comments

Comments
 (0)