BlobReader.ReadConstant(ConstantTypeCode) Method

Definition

Reads a constant value (see ECMA-335 Partition II section 22.9) from the current position.

C#
public object? ReadConstant(System.Reflection.Metadata.ConstantTypeCode typeCode);
C#
public object ReadConstant(System.Reflection.Metadata.ConstantTypeCode typeCode);

Parameters

typeCode
ConstantTypeCode

Returns

A boxed constant value. To avoid allocating the object use Read* methods directly.

Exceptions

Error while reading from the blob.

Remarks

Constants of type String are encoded as UTF16 strings, use ReadUTF16(Int32) to read them.

Applies to

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)