当前位置: 首页>>代码示例>>C#>>正文


C# MetadataReader.GetAssemblyReference方法代码示例

本文整理汇总了C#中System.Reflection.Metadata.MetadataReader.GetAssemblyReference方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataReader.GetAssemblyReference方法的具体用法?C# MetadataReader.GetAssemblyReference怎么用?C# MetadataReader.GetAssemblyReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.Metadata.MetadataReader的用法示例。


在下文中一共展示了MetadataReader.GetAssemblyReference方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToRuntimeAssemblyName

 public static RuntimeAssemblyName ToRuntimeAssemblyName(this AssemblyReferenceHandle assemblyReferenceHandle, MetadataReader reader)
 {
     AssemblyReference assemblyReference = reader.GetAssemblyReference(assemblyReferenceHandle);
     return CreateRuntimeAssemblyNameFromMetadata(
         reader,
         assemblyReference.Name,
         assemblyReference.Version,
         assemblyReference.Culture,
         assemblyReference.PublicKeyOrToken,
         assemblyReference.Flags
         );
 }
开发者ID:nattress,项目名称:corert,代码行数:12,代码来源:MetadataReaderExtensions.Ecma.cs

示例2: GetAssemblyReferences

        private static Reference[] GetAssemblyReferences(MetadataReader reader)
        {
            var references = new List<Reference>();

            foreach (var handle in reader.AssemblyReferences)
            {
                var reference = reader.GetAssemblyReference(handle);
                references.Add(new Reference(reader.GetString(reference.Name), reference.Version));
            }

            return references.ToArray();
        }
开发者ID:modulexcite,项目名称:ReferenceGenerator,代码行数:12,代码来源:AssemblyInfo.cs

示例3: ReadReferences

        private static ImmutableArray<AssemblyIdentity> ReadReferences(SystemMetadataReader metadataReader)
        {
            var builder = ImmutableArray.CreateBuilder<AssemblyIdentity>();
            foreach (var referenceHandle in metadataReader.AssemblyReferences)
            {
                var reference = metadataReader.GetAssemblyReference(referenceHandle);

                string refname = metadataReader.GetString(reference.Name);
                Version refversion = reference.Version;
                string refcultureName = metadataReader.GetString(reference.Culture);
                ImmutableArray<byte> refpublicKeyOrToken = metadataReader.GetBlobContent(reference.PublicKeyOrToken);
                AssemblyFlags refflags = reference.Flags;
                bool refhasPublicKey = (refflags & AssemblyFlags.PublicKey) != 0;

                builder.Add(new AssemblyIdentity(refname, refversion, refcultureName, refpublicKeyOrToken, hasPublicKey: refhasPublicKey));
            }

            return builder.ToImmutable();
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:19,代码来源:AnalyzerDependencyChecker.cs

示例4: GetAssemblyReferences

            private static AssemblyReference[] GetAssemblyReferences(MetadataReader reader)
            {
                var count = reader.GetTableRowCount(TableIndex.AssemblyRef);
                var references = new AssemblyReference[count];

                for (int i = 0; i < count; i++)
                {
                    var reference = reader.GetAssemblyReference(MetadataTokens.AssemblyReferenceHandle(i + 1));
                    references[i] = new AssemblyReference(reader.GetString(reference.Name), reference.Version);
                }

                return references.ToArray();
            }
开发者ID:roncain,项目名称:buildtools,代码行数:13,代码来源:VerifyClosure.cs

示例5: IsSameResolutionScope

        private bool IsSameResolutionScope(MetadataReader referenceMetadata, MetadataReader newMetadata, Handle referenceResolutionScope, Handle newResolutionScope)
        {
            if (referenceResolutionScope.IsNil != newResolutionScope.IsNil)
                return false;

            if (referenceResolutionScope.Kind != newResolutionScope.Kind)
                return false;

            switch (referenceResolutionScope.Kind)
            {
            case HandleKind.ModuleDefinition:
                Console.WriteLine("ResolutionScope:{0} checking not yet implemented.", referenceResolutionScope.Kind);
                break;

            case HandleKind.ModuleReference:
                Console.WriteLine("ResolutionScope:{0} checking not yet implemented.", referenceResolutionScope.Kind);
                break;

            case HandleKind.AssemblyReference:
                AssemblyReference referenceResolutionScopeAssemblyReference = referenceMetadata.GetAssemblyReference((AssemblyReferenceHandle)referenceResolutionScope);
                AssemblyReference newResolutionScopeAssemblyReference = newMetadata.GetAssemblyReference((AssemblyReferenceHandle)newResolutionScope);
                return IsSameResolutionScope(referenceMetadata, newMetadata, referenceResolutionScopeAssemblyReference, newResolutionScopeAssemblyReference);

            case HandleKind.TypeReference:
                Console.WriteLine("ResolutionScope:{0} checking not yet implemented.", referenceResolutionScope.Kind);
                break;

            default:
                throw new InvalidOperationException("Invalid ResolutionScope kind.");
            }

            return true;
        }
开发者ID:modulexcite,项目名称:dotnet-compatibility,代码行数:33,代码来源:Analyzer.cs


注:本文中的System.Reflection.Metadata.MetadataReader.GetAssemblyReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。