PEReaderExtensions.GetMetadataReader Method

Definition

Overloads

GetMetadataReader(PEReader)

Gets a MetadataReader from a PEReader.

GetMetadataReader(PEReader, MetadataReaderOptions)

Gets a metadata reader with the specified metadata reading configuration from a PEReader.

GetMetadataReader(PEReader, MetadataReaderOptions, MetadataStringDecoder)

Gets a metadata reader with the specified metadata reading configuration and encoding configuration from a PEReader.

GetMetadataReader(PEReader)

Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs

Gets a MetadataReader from a PEReader.

C#
public static System.Reflection.Metadata.MetadataReader GetMetadataReader(this System.Reflection.PortableExecutable.PEReader peReader);

Parameters

peReader
PEReader

The current PEReader instance.

Returns

A metadata reader.

Exceptions

peReader is null.

The current platform is big-endian.

IO error while reading from the underlying stream.

Remarks

The caller must keep the PEReader alive and undisposed throughout the lifetime of the metadata reader.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

GetMetadataReader(PEReader, MetadataReaderOptions)

Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs

Gets a metadata reader with the specified metadata reading configuration from a PEReader.

C#
public static System.Reflection.Metadata.MetadataReader GetMetadataReader(this System.Reflection.PortableExecutable.PEReader peReader, System.Reflection.Metadata.MetadataReaderOptions options);

Parameters

peReader
PEReader

The current PEReader instance.

options
MetadataReaderOptions

An enumeration value indicating the metadata reading configuration.

Returns

A metadata reader with the specified metadata reading configuration.

Exceptions

peReader is null.

The current platform is big-endian.

IO error while reading from the underlying stream.

Remarks

The caller must keep the PEReader alive and undisposed throughout the lifetime of the metadata reader.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

GetMetadataReader(PEReader, MetadataReaderOptions, MetadataStringDecoder)

Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs
Source:
PEReaderExtensions.cs

Gets a metadata reader with the specified metadata reading configuration and encoding configuration from a PEReader.

C#
public static System.Reflection.Metadata.MetadataReader GetMetadataReader(this System.Reflection.PortableExecutable.PEReader peReader, System.Reflection.Metadata.MetadataReaderOptions options, System.Reflection.Metadata.MetadataStringDecoder utf8Decoder);
C#
public static System.Reflection.Metadata.MetadataReader GetMetadataReader(this System.Reflection.PortableExecutable.PEReader peReader, System.Reflection.Metadata.MetadataReaderOptions options, System.Reflection.Metadata.MetadataStringDecoder? utf8Decoder);

Parameters

peReader
PEReader

The current PEReader instance.

options
MetadataReaderOptions

An enumeration value indicating the metadata reading configuration.

utf8Decoder
MetadataStringDecoder

A metadata string decoder with the encoding configuration.

Returns

>A metadata reader with the specified metadata reading configuration and encoding configuration.

Exceptions

peReader is null.

The encoding of utf8Decoder is not UTF8Encoding.

The current platform is big-endian.

IO error while reading from the underlying stream.

Remarks

The caller must keep the PEReader undisposed throughout the lifetime of the metadata reader.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0