/// <summary> /// Parses an assembly name /// </summary> /// <param name="asmFullName">Full assembly name</param> /// <param name="gpContext">Generic parameter context</param> /// <returns>A new <see cref="AssemblyRef"/> instance or <c>null</c> if parsing failed</returns> public static AssemblyRef ParseAssemblyRef(string asmFullName, GenericParamContext gpContext) { try { using (var parser = new ReflectionTypeNameParser(null, asmFullName, null, gpContext)) return(parser.ReadAssemblyRef()); } catch { return(null); } }
/// <summary> /// Parses a Reflection type name and creates a <see cref="ITypeDefOrRef"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="ITypeDefOrRef"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <param name="gpContext">Generic parameter context</param> /// <returns>A new <see cref="ITypeDefOrRef"/> instance</returns> /// <exception cref="TypeNameParserException">If parsing failed</exception> public static ITypeDefOrRef ParseReflectionThrow(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper, GenericParamContext gpContext) { using (var parser = new ReflectionTypeNameParser(ownerModule, typeFullName, typeNameParserHelper, gpContext)) return(parser.Parse()); }