static void ValidateArguments (char[] buffer, int index, int count)
{
if (buffer == null)
throw new ArgumentNullException ("buffer");
if (index < 0 || index > buffer.Length)
throw new ArgumentOutOfRangeException ("index");
if (count < 0 || count > (buffer.Length - index))
throw new ArgumentOutOfRangeException ("count");
}