示例#1
0
        /// <summary>
        /// Uses reflection to create an object using its
        /// default constructor.
        /// </summary>
        /// <param name="objectType">Type of object to create.</param>
        public static object CreateInstance(Type objectType)
        {
            DynamicConstructor ctor = GetCachedConstructor(objectType);

            if (ctor == null)
            {
                throw new NotImplementedException("Default Constructor not implemented.");
            }
            return(ctor.Invoke());
        }