Ejemplo n.º 1
0
        /// <summary>
        /// Creates an <see cref="Object"/> from the type specified.
        /// </summary>
        /// <param name="type">Specifies the type of the object to create.</param>
        /// <param name="arguments">Specifies the arguments to pass to the constructor.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="type"/> is <see langword="null"/>.
        /// </exception>
        public static Object CreateObject(Type type, Object[] arguments)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            return(NuGenActivator.CreateObject(type.ToString(), arguments));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an <see cref="Object"/> from the type specified.
        /// </summary>
        /// <param name="typeName">Specifies the type of the object to create.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="typeName"/> is <see langword="null"/>.
        /// -or-
        /// <paramref name="typeName"/> is an emtpy string.
        /// </exception>
        public static Object CreateObject(String typeName)
        {
            if (String.IsNullOrEmpty(typeName))
            {
                throw new ArgumentNullException("typeName");
            }

            return(NuGenActivator.CreateObject(typeName, new Object[0]));
        }