-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
To support a cleaner foreach loop It'd be great to rename (or alias for backwards compatibility) Scheme<TColor>.Enumerate to Scheme<TColor>.GetEnumerator.
// old
foreach (var (key, color) in scheme.Enumerate())
{
// ...
}
// new
foreach (var (key, color) in scheme)
{
// ...
}This makes the use of it more C#-like. Just the method should be enough, but you might as well implement IEnumerable which supplies this exact method, and makes it LINQ-compatible.
I think it can be easily done from the source generator, by simply adding 1 extra line to the generated code:
public IEnumerator<KeyValuePair<string, TColor>> GetEnumerator() => Enumerate();danielchalmersalbi005
Metadata
Metadata
Assignees
Labels
No labels