Ejemplo n.º 1
0
        private T[] CheckArgs <T>(IEnumerable <T> types)
        {
            if (types == null)
            {
                throw new ArgumentNullException("types");
            }
            var typesArray = types.ToArray();

            if (typesArray.Length != this.GenericParameters.Count)
            {
                throw DotNetFailure.GenericParametersLengthMismatch("types");
            }

            return(typesArray);
        }
Ejemplo n.º 2
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));
        }