TypeNotIEnumerable() статический приватный Метод

ArgumentException with message like "Type '{0}' is not IEnumerable"
static private TypeNotIEnumerable ( object p0, string paramName ) : Exception
p0 object
paramName string
Результат Exception
Пример #1
0
 private static void ValidateListInitArgs(Type listType, IEnumerable <ElementInit> initializers)
 {
     if (!typeof(IEnumerable).IsAssignableFrom(listType))
     {
         throw Error.TypeNotIEnumerable(listType);
     }
     foreach (var element in initializers)
     {
         ContractUtils.RequiresNotNull(element, "initializers");
         ValidateCallInstanceType(listType, element.AddMethod);
     }
 }
Пример #2
0
 private static void ValidateListInitArgs(Type listType, ReadOnlyCollection <ElementInit> initializers, string listTypeParamName)
 {
     if (!typeof(IEnumerable).IsAssignableFrom(listType))
     {
         throw Error.TypeNotIEnumerable(listType, listTypeParamName);
     }
     for (int i = 0, n = initializers.Count; i < n; i++)
     {
         ElementInit element = initializers[i];
         ContractUtils.RequiresNotNull(element, nameof(initializers), i);
         ValidateCallInstanceType(listType, element.AddMethod);
     }
 }