Created
March 16, 2019 03:32
-
-
Save tsengeagle/28c1439d761bf630a061a53d901a2af7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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