Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool ArrayElementsAreEqual(string[] arrayToCheck)
- {
- if (arrayToCheck == null || arrayToCheck.Length == 0)
- {
- // Empty arrays are considered equal I guess?
- return true;
- // Or throw an error
- // throw new Exception("wtf");
- }
- var firstChar = arrayToCheck[0];
- var lastIndex = arrayToCheck.Length - 1;
- for()
- for (var index = 1; index <= lastIndex; index++)
- {
- if (arrayToCheck[index] != firstChar)
- {
- return false;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement