Ejemplo n.º 1
0
        public AssemblyName[] GetAssemblyReferences()
        {
            var count      = _metaReader.GetTableRowCount(TableIndex.AssemblyRef);
            var references = new AssemblyName[count];

            for (int i = 0; i < count; i++)
            {
                var assemblyRef     = _metaReader.GetAssemblyReference(MetadataTokens.AssemblyReferenceHandle(i + 1));
                var assemblyRefName = _metaReader.GetString(assemblyRef.Name);
                var cultureName     = assemblyRef.Culture.IsNil ? "neutral" : _metaReader.GetString(assemblyRef.Culture);
                var pubKeyTok       = AssemblyHelpers.FormatPublicKeyToken(_metaReader, assemblyRef.PublicKeyOrToken);

                references[i] = new AssemblyName(string.Format("{0}, Version={1}, Culture={2}, PublicKeyToken={3}", assemblyRefName, assemblyRef.Version, cultureName, pubKeyTok));
            }

            return(references);
        }