Exemple #1
0
        public static IValidationContext <IEnumerable <T> > IsValidIndex <T>(this IValidationContext <IEnumerable <T> > context, int index)
        {
            context.IsNotEmptyEnumerable();

            if (index < 0 || index >= context.Value.Count())
            {
                throw new ArgumentOutOfRangeException(context.ParameterName);
            }

            return(context);
        }