本文整理汇总了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
);
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}