Ejemplo n.º 1
0
 private void RequireTemplates(IEnumerable <HxlTemplate> templates)
 {
     if (templates == null)
     {
         throw new ArgumentNullException("templates");
     }
     if (!templates.Any())
     {
         throw Failure.EmptyCollection("templates");
     }
     if (templates.Any(t => t == null))
     {
         throw Failure.CollectionContainsNullElement("templates");
     }
 }
Ejemplo n.º 2
0
 public static MetadataName Combine(params MetadataName[] names)
 {
     if (names == null)
     {
         throw new ArgumentNullException("names");
     }
     if (names.Length == 0)
     {
         throw Failure.EmptyCollection("names");
     }
     if (names.Any(t => t == null))
     {
         throw Failure.CollectionContainsNullElement("names");
     }
     return(names.Reverse().Aggregate((x, y) => y.AddRight(x)));
 }
Ejemplo n.º 3
0
        public GenericInstanceTypeName MakeGenericType(params TypeName[] arguments)
        {
            if (arguments == null)
            {
                throw new ArgumentNullException("arguments");
            }
            if (arguments.Length == 0)
            {
                throw Failure.EmptyCollection("arguments");
            }
            if (arguments.Any(t => t == null))
            {
                throw Failure.CollectionContainsNullElement("arguments");
            }
            if (arguments.Length != this.GenericParameterCount)
            {
                throw DotNetFailure.GenericParametersLengthMismatch("arguments");
            }

            return(new GenericInstanceTypeName(this, arguments));
        }