コード例 #1
0
        public Type GetType(string typeName)
        {
            Type?type = DefaultAssembly?.GetType(typeName)
                        ?? DefaultAssembly?.GetType(combineWithNamespace(typeName))
                        ?? Type.GetType(typeName)
                        ?? Type.GetType(combineWithNamespace(typeName));

            if (type == null)
            {
                throw new ArgumentException($"Type {typeName} not found!");
            }
            return(type);
        }
コード例 #2
0
        /// <summary>
        /// 取得类型
        /// </summary>
        /// <returns>类型</returns>
        private Type GetType(string typeName)
        {
            Type type = Type.GetType(typeName);

            if (type == null)
            {
                type = DefaultAssembly.GetType(typeName);
            }
            if (type == null)
            {
                type = CallingAssembly.GetType(typeName);
            }
            if (type == null)
            {
                type = ExecutingAssembly.GetType(typeName);
            }
            if (type == null)
            {
                type = EntryAssembly.GetType(typeName);
            }
            return(type);
        }