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"); } }
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))); }
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)); }