Struct ConstantRow
- Namespace
- AsmResolver.PE.DotNet.Metadata.Tables
- Assembly
- AsmResolver.PE.dll
Represents a single row in the constants metadata table.
public struct ConstantRow : IMetadataRow, IReadOnlyList<uint>, IReadOnlyCollection<uint>, IEnumerable<uint>, IEnumerable, IEquatable<ConstantRow>
- Implements
- Inherited Members
Constructors
ConstantRow(ElementType, byte, uint, uint)
Creates a new row for the constants metadata table.
public ConstantRow(ElementType type, byte padding, uint parent, uint value)
Parameters
type
ElementTypeThe type of constant that is stored in the blob stream.
padding
byteThe single padding byte between the type and parent columns.
parent
uintThe HasConstant index (an index into either the Field, Parameter or Property table) that is the owner of the constant.
value
uintThe index into the #Blob stream containing the serialized constant value.
ConstantRow(ElementType, uint, uint)
Creates a new row for the constants metadata table.
public ConstantRow(ElementType type, uint parent, uint value)
Parameters
type
ElementTypeThe type of constant that is stored in the blob stream.
parent
uintThe HasConstant index (an index into either the Field, Parameter or Property table) that is the owner of the constant.
value
uintThe index into the #Blob stream containing the serialized constant value.
Properties
Count
Gets the number of elements in the collection.
public int Count { get; }
Property Value
- int
The number of elements in the collection.
this[int]
Gets the element at the specified index in the read-only list.
public uint this[int index] { get; }
Parameters
index
intThe zero-based index of the element to get.
Property Value
- uint
The element at the specified index in the read-only list.
Padding
Gets or sets the single padding byte between the type and parent columns.
public byte Padding { readonly get; set; }
Property Value
Remarks
This field should always be zero.
Parent
Gets a HasConstant index (an index into either the Field, Parameter or Property table) that is the owner of the constant.
public uint Parent { readonly get; set; }
Property Value
TableIndex
Gets or sets the index of the table that this row is stored in.
public TableIndex TableIndex { get; }
Property Value
Type
Gets or sets the type of constant that is stored in the blob stream.
public readonly ElementType Type { get; }
Property Value
Remarks
This field must always be a value-type.
Value
Gets or sets an index into the #Blob stream containing the serialized constant value.
public uint Value { readonly get; set; }
Property Value
Methods
Equals(ConstantRow)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ConstantRow other)
Parameters
other
ConstantRowAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
FromReader(ref BinaryStreamReader, TableLayout)
Reads a single constant row from an input stream.
public static ConstantRow FromReader(ref BinaryStreamReader reader, TableLayout layout)
Parameters
reader
BinaryStreamReaderThe input stream.
layout
TableLayoutThe layout of the constants table.
Returns
- ConstantRow
The row.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<uint> GetEnumerator()
Returns
- IEnumerator<uint>
An enumerator that can be used to iterate through the collection.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Write(BinaryStreamWriter, TableLayout)
Writes the row to an output stream.
public void Write(BinaryStreamWriter writer, TableLayout layout)
Parameters
writer
BinaryStreamWriterThe output stream writer.
layout
TableLayoutThe new layout of the table.
Operators
operator ==(ConstantRow, ConstantRow)
Determines whether two rows are considered equal.
public static bool operator ==(ConstantRow left, ConstantRow right)
Parameters
left
ConstantRowright
ConstantRow
Returns
operator !=(ConstantRow, ConstantRow)
Determines whether two rows are not considered equal.
public static bool operator !=(ConstantRow left, ConstantRow right)
Parameters
left
ConstantRowright
ConstantRow