Skip to content

Instantly share code, notes, and snippets.

@JohnMGant
Created July 17, 2020 20:08
Show Gist options
  • Select an option

  • Save JohnMGant/445a7676e20731525b168e2f7185c4e5 to your computer and use it in GitHub Desktop.

Select an option

Save JohnMGant/445a7676e20731525b168e2f7185c4e5 to your computer and use it in GitHub Desktop.
internal class EnumeratorAdder : IIntegerAdder
{
public int Add(int[] values)
{
IEnumerator<int> enumerator = values.AsEnumerable().GetEnumerator();
int sum = 0;
while (enumerator.MoveNext())
{
sum += enumerator.Current;
}
return sum;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment