.Length
internal static bool ArrayMatches(char[] array, int startIndex, string target) { if (startIndex < 0) { return false; } int targetLength = target.Length; if (targetLength + startIndex >= array.Length) { return false; } for (int idx = 0; idx < targetLength; ++idx) { if (array[idx + startIndex] != target[idx]) { return false; } } return true; }
public void Extensions_ArrayMatches_Mismatch() { Assert.IsFalse(Extensions.ArrayMatches(s_testArray, 0, "match")); }