Пример #1
0
 /// <summary>
 /// Gets a type
 /// </summary>
 /// <param name="type">Type</param>
 /// <param name="options">Options</param>
 /// <returns></returns>
 public DmdType GetType(Type type, DmdGetTypeOptions options)
 {
     if ((object)type == null)
     {
         throw new ArgumentNullException(nameof(type));
     }
     return(GetType(type.FullName, options));
 }
Пример #2
0
 /// <summary>
 /// Gets a type
 /// </summary>
 /// <param name="type">Type</param>
 /// <param name="options">Options</param>
 /// <returns></returns>
 public DmdType?GetType(Type type, DmdGetTypeOptions options)
 {
     if (type is null)
     {
         throw new ArgumentNullException(nameof(type));
     }
     return(GetType(type.AssemblyQualifiedName, options));
 }
Пример #3
0
        /// <summary>
        /// Gets a type
        /// </summary>
        /// <param name="type">Type</param>
        /// <param name="options">Options</param>
        /// <returns></returns>
        public DmdType?GetType(Type type, DmdGetTypeOptions options)
        {
            if (type is null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            var fullname = type.FullName ?? throw new ArgumentException();

            return(GetType(fullname, options));
        }
Пример #4
0
        public override DmdType GetType(string typeName, DmdGetTypeOptions options)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException(nameof(typeName));
            }

            var resolver = new TypeDefResolver(this, (options & DmdGetTypeOptions.IgnoreCase) != 0);
            var type     = DmdTypeNameParser.Parse(resolver, typeName);

            if ((object)type != null)
            {
                return(appDomain.Intern(type, DmdMakeTypeOptions.NoResolve));
            }

            if ((options & DmdGetTypeOptions.ThrowOnError) != 0)
            {
                throw new TypeNotFoundException(typeName);
            }
            return(null);
        }
Пример #5
0
 /// <summary>
 /// Gets a type
 /// </summary>
 /// <param name="typeName">Full name of the type (<see cref="DmdType.FullName"/>)</param>
 /// <param name="options">Options</param>
 /// <returns></returns>
 public abstract DmdType GetType(string typeName, DmdGetTypeOptions options);