Skip to content

Instantly share code, notes, and snippets.

@kobi
Created July 6, 2011 08:14
Show Gist options
  • Save kobi/1066812 to your computer and use it in GitHub Desktop.
Save kobi/1066812 to your computer and use it in GitHub Desktop.
public static IEnumerable<Point> GetPoints(IEnumerable<int> coordinates)
{
var e = coordinates.GetEnumerator();
while (e.MoveNext())
{
int x = e.Current;
// here I assume the length isn't odd, so I ignore the result of MoveNext
e.MoveNext();
int y = e.Current;
yield return new Point(x, y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment