MetadataReader クラス
定義
ECMA 335 CLI 仕様で定義されているとおりにメタデータを読み取ります。Reads metadata as defined by the ECMA 335 CLI specification.
public ref class MetadataReader sealed
public sealed class MetadataReader
type MetadataReader = class
Public NotInheritable Class MetadataReader
- 継承
-
MetadataReader
例
この例では、 MetadataReader アセンブリに対してを作成し、そこからすべての型定義を読み取る方法を示します。This example shows how to create MetadataReader for an assembly and read all type definitions from it:
using var fs = new FileStream("Example.dll", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using var peReader = new PEReader(fs);
MetadataReader mr = peReader.GetMetadataReader();
foreach (TypeDefinitionHandle tdefh in mr.TypeDefinitions)
{
TypeDefinition tdef = mr.GetTypeDefinition(tdefh);
string ns = mr.GetString(tdef.Namespace);
string name = mr.GetString(tdef.Name);
Console.WriteLine($"{ns}.{name}");
}
注釈
MetadataReader 指定された CLI メタデータからテーブルとヒープの内容を読み取ります。MetadataReader reads the contents of tables and heaps from the specified CLI metadata. 型やメソッドの定義などの低レベルのコンストラクトを操作します。It operates low-level constructs such as type and method definitions. リフレクションコンストラクトを使用してアセンブリの内容を検査する上位レベルの API については、「」を参照してください MetadataLoadContext 。For a higher level API to inspect the contents of assemblies using reflection constructs, see MetadataLoadContext.
などのコンストラクターを使用して MetadataReader(Byte*, Int32) 、 MetadataReader 特定のメモリ位置に対してのインスタンスを作成できます。You can use constructors, such as MetadataReader(Byte*, Int32), to create an instance of MetadataReader for a given memory location. 移植可能な実行可能アセンブリファイルからメタデータを読み取るには、 PEReader 拡張メソッドを作成して使用し GetMetadataReader(PEReader) ます。To read metadata from the Portable Executable assembly file, create PEReader and use the GetMetadataReader(PEReader) extension method.
CLI メタデータの形式は、ECMA-335 仕様で定義されています。The format of CLI metadata is defined by the ECMA-335 specification. 詳細については、エクマインターナショナル Web サイトの「 STANDARD ECMA-335-Common Language Infrastructure (CLI) 」を参照してください。For more information, see Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.
コンストラクター
MetadataReader(Byte*, Int32) |
指定のメモリ場所に保存されているメタデータから MetadataReader クラスの新しいインスタンスを初期化します。Initializes a new instance of the MetadataReader class from the metadata stored at the given memory location. |
MetadataReader(Byte*, Int32, MetadataReaderOptions) |
指定のメモリ場所に保存されているメタデータから MetadataReader クラスの新しいインスタンスを初期化します。Initializes a new instance of the MetadataReader class from the metadata stored at the given memory location. |
MetadataReader(Byte*, Int32, MetadataReaderOptions, MetadataStringDecoder) |
指定のメモリ場所に保存されているメタデータから MetadataReader クラスの新しいインスタンスを初期化します。Initializes a new instance of the MetadataReader class from the metadata stored at the given memory location. |
プロパティ
AssemblyFiles | |
AssemblyReferences | |
CustomAttributes | |
CustomDebugInformation | |
DebugMetadataHeader |
#Pdb ストリームからデコードされた情報を取得します。あるいは、ストリームがない場合は |
DeclarativeSecurityAttributes | |
Documents | |
EventDefinitions | |
ExportedTypes | |
FieldDefinitions | |
ImportScopes | |
IsAssembly |
メタデータがアセンブリを表すかどうかを示す値を取得します。Gets a value that indicates whether the metadata represents an assembly. |
LocalConstants | |
LocalScopes | |
LocalVariables | |
ManifestResources | |
MemberReferences | |
MetadataKind |
メタデータの種類を取得します。Gets the metadata kind. |
MetadataLength |
基になるデータの長さを取得します。Gets the length of the underlying data. |
MetadataPointer |
基になるデータへのポインターを取得します。Gets the pointer to the underlying data. |
MetadataVersion |
メタデータ ヘッダーから読み込まれたバージョン文字列を取得します。Gets the version string read from metadata header. |
MethodDebugInformation | |
MethodDefinitions | |
Options |
コンストラクターに渡された MetadataReaderOptions を取得します。Gets the MetadataReaderOptions passed to the constructor. |
PropertyDefinitions | |
StringComparer |
メタデータに格納されている文字列を比較するための比較子を取得します。Gets the comparer used to compare strings stored in metadata. |
TypeDefinitions | |
TypeReferences | |
UTF8Decoder |
UTF8 でエンコードされたバイト シーケンスから文字列インスタンスを生成するためにリーダーによって使用されるデコーダーを取得します。Gets the decoder used by the reader to produce string instances from UTF8-encoded byte sequences. |
メソッド
拡張メソッド
GetEditAndContinueLogEntries(MetadataReader) |
EnC ログのエントリを列挙します。Enumerates entries of EnC log. |
GetEditAndContinueMapEntries(MetadataReader) |
EnC マップのエントリを列挙します。Enumerates entries of EnC map. |
GetHeapMetadataOffset(MetadataReader, HeapIndex) |
メタデータの先頭から指定したヒープまでのオフセットを返します。Returns the offset from the start of metadata to the specified heap. |
GetHeapSize(MetadataReader, HeapIndex) |
指定したヒープのサイズを返します。Returns the size of the specified heap. |
GetNextHandle(MetadataReader, BlobHandle) |
Blob ヒープ内の指定した Blob ハンドルの次を返します。最後の場合は nil ハンドルを返します。Returns the handle to the Blob that follows the given one in the Blob heap or a nil handle if it is the last one. |
GetNextHandle(MetadataReader, StringHandle) |
文字列ヒープ内の指定した文字列ハンドルの次を返します。最後の場合は nil ハンドルを返します。Returns the a handle to the string that follows the given one in the string heap, or a nil handle if it is the last one. |
GetNextHandle(MetadataReader, UserStringHandle) |
UserString ヒープ内の指定した UserString ハンドルの次を返します。最後の場合は nil ハンドルを返します。Returns the a handle to the UserString that follows the given one in the UserString heap or a nil handle if it is the last one. |
GetTableMetadataOffset(MetadataReader, TableIndex) |
メタデータの先頭から指定したテーブルまでのオフセットを返します。Returns the offset from the start of metadata to the specified table. |
GetTableRowCount(MetadataReader, TableIndex) |
指定したテーブル内の行数を返します。Returns the number of rows in the specified table. |
GetTableRowSize(MetadataReader, TableIndex) |
指定したテーブル内の行のサイズを返します。Returns the size of a row in the specified table. |
GetTypesWithEvents(MetadataReader) |
1 つ以上のイベントを定義する型を列挙します。Enumerate types that define one or more events. |
GetTypesWithProperties(MetadataReader) |
1 つ以上のプロパティを定義する型を列挙します。Enumerate types that define one or more properties. |
ResolveSignatureTypeKind(MetadataReader, EntityHandle, Byte) |
署名 BLOB に、型ハンドルと未加工の型の種類が見つかった場合、それによってターゲットの型が値型か参照型かが決まります。Given a type handle and a raw type kind found in a signature blob determines whether the target type is a value type or a reference type. |
GetHeapOffset(MetadataReader, Handle) |
|
GetRowNumber(MetadataReader, EntityHandle) |
|
GetToken(MetadataReader, EntityHandle) |
|
GetToken(MetadataReader, Handle) |
|