Exemplo n.º 1
0
        /// <summary>
        /// Converts WinMD type <paramref name="et"/> to a CLR type. Returns <c>null</c>
        /// if it's not a CLR compatible WinMD type.
        /// </summary>
        /// <param name="module">Owner module or <c>null</c></param>
        /// <param name="et">Type</param>
        /// <returns></returns>
        public static ExportedType ToCLR(ModuleDef module, ExportedType et)
        {
            if (et == null)
            {
                return(null);
            }
            var defAsm = et.DefinitionAssembly;

            if (defAsm == null || !defAsm.IsContentTypeWindowsRuntime)
            {
                return(null);
            }
            if (et.DeclaringType != null)
            {
                return(null);
            }

            if (!winMDToCLR.TryGetValue(new ClassName(et.TypeNamespace, et.TypeName), out var pc))
            {
                return(null);
            }

            return(new ExportedTypeUser(module, 0, pc.ClrClass.Namespace, pc.ClrClass.Name, et.Attributes, CreateAssembly(module, pc.ContractAssembly)));
        }
Exemplo n.º 2
0
 bool ContainsGenericParameterInternal(ExportedType type) => false;
Exemplo n.º 3
0
 /// <summary>
 /// Checks whether <paramref name="type"/> contains a <see cref="GenericVar"/> or a
 /// <see cref="GenericMVar"/>.
 /// </summary>
 /// <param name="type">Type</param>
 /// <returns><c>true</c> if <paramref name="type"/> contains a <see cref="GenericVar"/> or a
 /// <see cref="GenericMVar"/>.</returns>
 public static bool ContainsGenericParameter(ExportedType type) => new TypeHelper().ContainsGenericParameterInternal(type);