internal static int GetCommonPathLength(string first, string second, bool ignoreCase)
        {
            int index = PathInternal.EqualStartingCharacterCount(first, second, ignoreCase);

            if (index == 0 || index == first.Length && (index == second.Length || PathInternal.IsDirectorySeparator(second[index])) || index == second.Length && PathInternal.IsDirectorySeparator(first[index]))
            {
                return(index);
            }
            while (index > 0 && !PathInternal.IsDirectorySeparator(first[index - 1]))
            {
                --index;
            }
            return(index);
        }