Ejemplo n.º 1
0
 public static void ValidIndex(
     int index,
     [NotNull, InvokerParameterName] string argName)
 {
     if (index < 0)
     {
         throw CodeExceptions.IndexOutOfRange(argName, index, 0, int.MaxValue);
     }
 }
Ejemplo n.º 2
0
 public static void ValidIndex(
     int index,
     [NotNull, InvokerParameterName] string argName,
     int length)
 {
     if (index < 0 || index >= length)
     {
         throw CodeExceptions.IndexOutOfRange(argName, index, 0, length);
     }
 }
Ejemplo n.º 3
0
        public static void ValidIndexPair(
            int fromIndex,
            [NotNull, InvokerParameterName] string fromIndexName,
            int toIndex,
            [NotNull, InvokerParameterName] string toIndexName,
            int length)
        {
            ValidIndex(fromIndex, fromIndexName, length);

            if (toIndex < fromIndex || toIndex >= length)
            {
                throw CodeExceptions.IndexOutOfRange(toIndexName, toIndex, fromIndex, length);
            }
        }