Skip to content

Instantly share code, notes, and snippets.

@tsengeagle
Created March 16, 2019 03:32
Show Gist options
  • Save tsengeagle/28c1439d761bf630a061a53d901a2af7 to your computer and use it in GitHub Desktop.
Save tsengeagle/28c1439d761bf630a061a53d901a2af7 to your computer and use it in GitHub Desktop.
private bool JoeySequenceEqual(IEnumerable<int> first, IEnumerable<int> second)
{
var firstEnumerator = first.GetEnumerator();
var secondEnumerator = second.GetEnumerator();
var result = true;
while (firstEnumerator.MoveNext() )
{
if (secondEnumerator.MoveNext())
{
if (firstEnumerator.Current != secondEnumerator.Current)
{
return false;
}
}
else
{
return false;
}
}
if (secondEnumerator.MoveNext())
{
return false;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment