Skip to content

Commit

Permalink
Advise against non-yield solutions (#2336)
Browse files Browse the repository at this point in the history
As the Accumulate method is supposed to be lazy, the mentors should advise against solutions that don't use the yield keyword
  • Loading branch information
Gautzilla authored Mar 26, 2024
1 parent 838fe92 commit 0b2154f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tracks/csharp/exercises/accumulate/mentoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public static class AccumulateExtensions

### Storing the results in an intermediate list

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.

```csharp
using System;
using System.Collections.Generic;
Expand Down

0 comments on commit 0b2154f

Please sign in to comment.