Interface IMetadataTable
- Namespace
- AsmResolver.PE.DotNet.Metadata.Tables
- Assembly
- AsmResolver.PE.dll
Represents a metadata table stored in the tables stream of a managed executable.
public interface IMetadataTable : ICollection, IEnumerable, ISegment, IOffsetProvider, IWritable- Inherited Members
Properties
IsSorted
Gets or sets a value indicating whether the table is considered sorted.
bool IsSorted { get; set; }Property Value
this[int]
Gets or sets the row at the provided index.
IMetadataRow this[int index] { get; set; }Parameters
- indexint
- The index of the row to get. 
Property Value
Exceptions
- IndexOutOfRangeException
- Occurs when the index is too small or too large for this table. 
Layout
Gets the layout of the table.
TableLayout Layout { get; }Property Value
Methods
GetByRid(uint)
Gets the contents of a row by its row identifier.
IMetadataRow GetByRid(uint rid)Parameters
- riduint
- The row identifier. 
Returns
- IMetadataRow
- The row. 
GetRowBounds(uint)
Calculates the offset range of a row within the table.
OffsetRange GetRowBounds(uint rid)Parameters
- riduint
- The identifier of the row to get the bounds of. 
Returns
- OffsetRange
- The bounds. 
Remarks
This method does not do any verification on whether rid is a valid row in the table.
SetByRid(uint, IMetadataRow)
Sets the contents of a row by its row identifier.
void SetByRid(uint rid, IMetadataRow row)Parameters
- riduint
- The row identifier. 
- rowIMetadataRow
- The new contents of the row. 
TryGetByRid(uint, out IMetadataRow)
Attempts to get the contents of a row by its row identifier.
bool TryGetByRid(uint rid, out IMetadataRow row)Parameters
- riduint
- The row identifier. 
- rowIMetadataRow
- When successful, the read row. 
Returns
- bool
- trueif the RID existed and the row was obtained successfully,- falseotherwise.
TryGetCell(uint, int, out uint)
Attempts to get the contents of a cell in the table by its row identifier and column index.
bool TryGetCell(uint rid, int column, out uint value)Parameters
- riduint
- The row identifier. 
- columnint
- The column index. 
- valueuint
- When successful, the contents of the cell, converted to an unsigned integer. 
Returns
- bool
- trueif the cell existed and was obtained successfully,- falseotherwise.
TryGetRidByKey(int, uint, out uint)
Attempts to find a row index in a table by a key. This requires the table to be sorted.
bool TryGetRidByKey(int keyColumnIndex, uint key, out uint rid)Parameters
- keyColumnIndexint
- The column number to get the key from. 
- keyuint
- The key to search. 
- riduint
- When this functions returns - true, this parameter contains the RID of the row that contains the given key.
Returns
- bool
- trueif the row was found,- falseotherwise.
TryGetRowByKey(int, uint, out IMetadataRow)
Gets a single row in a table by a key. This requires the table to be sorted.
bool TryGetRowByKey(int keyColumnIndex, uint key, out IMetadataRow row)Parameters
- keyColumnIndexint
- The column number to get the key from. 
- keyuint
- The key to search. 
- rowIMetadataRow
- When this functions returns - true, this parameter contains the first row that contains the given key.
Returns
- bool
- trueif the row was found,- falseotherwise.
UpdateTableLayout(TableLayout)
Updates the table layout.
void UpdateTableLayout(TableLayout layout)Parameters
- layoutTableLayout
- The new table layout. 
Remarks
This method is used to update the sizes of each column, and therefore requires the new layout to have the same names and column types as the original one.