public unsafe virtual int IndexOf(String source, char value, int startIndex, int count, CompareOptions options)
{
// Validate inputs
if (source == null)
throw new ArgumentNullException("source");
if (startIndex < 0 || startIndex > source.Length)
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_Index"));
if (count < 0 || startIndex > source.Length - count)
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("ArgumentOutOfRange_Count"));
if (options == CompareOptions.OrdinalIgnoreCase)
{
return TextInfo.nativeIndexOfCharOrdinalIgnoreCase(
TextInfo.InvariantNativeTextInfo,
source,
value,
startIndex,
count);
}
// Validate CompareOptions
// Ordinal can't be selected with other flags
if ((options & ValidIndexMaskOffFlags) != 0 && (options != CompareOptions.Ordinal))
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options");
return IndexOfChar(m_pSortingTable, this.m_sortingLCID, source, value, startIndex, count, (int)options);
}