Struct MetadataToken
- Namespace
- AsmResolver.PE.DotNet.Metadata.Tables
- Assembly
- AsmResolver.PE.dll
Represents a metadata token, referencing a member using a table and a row index.
public readonly struct MetadataToken : IComparable<MetadataToken>
- Implements
- Inherited Members
Constructors
MetadataToken(TableIndex, uint)
Creates a new metadata token from a table index and a row index.
public MetadataToken(TableIndex table, uint rid)
Parameters
tableTableIndexThe table.
riduintThe row index.
Exceptions
- ArgumentOutOfRangeException
Occurs when
ridis too large.
MetadataToken(uint)
Creates a new metadata token from a raw 32 bit integer.
public MetadataToken(uint value)
Parameters
valueuintThe raw metadata token.
Fields
Zero
Represents the zero metadata token, or the absence of a metadata token.
public static readonly MetadataToken Zero
Field Value
Properties
Rid
Gets the row index within the table specified by Table that the metadata token references.
public uint Rid { get; }
Property Value
Table
Gets the table that the metadata token references.
public TableIndex Table { get; }
Property Value
Methods
CompareTo(MetadataToken)
public int CompareTo(MetadataToken other)
Parameters
otherMetadataToken
Returns
Equals(MetadataToken)
Determines whether the metadata token refers to the same member as another metadata token.
public bool Equals(MetadataToken other)
Parameters
otherMetadataTokenThe other metadata token.
Returns
- bool
trueif the token refers to the same member,falseotherwise.
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToInt32()
Converts the metadata token to a signed 32 bit integer.
public int ToInt32()
Returns
- int
The raw metadata token.
ToString()
public override string ToString()
Returns
ToUInt32()
Converts the metadata token to an unsigned 32 bit integer.
public uint ToUInt32()
Returns
- uint
The raw metadata token.
Operators
operator ==(MetadataToken, MetadataToken)
Determines whether two metadata tokens are considered equal. That is, both the table index and the row identifier match.
public static bool operator ==(MetadataToken a, MetadataToken b)
Parameters
aMetadataTokenThe first metadata token.
bMetadataTokenThe second metadata token.
Returns
- bool
trueif the tokens are considered equal,falseotherwise.
implicit operator MetadataToken(int)
Converts a 32-bit integer to a metadata token.
public static implicit operator MetadataToken(int token)
Parameters
tokenintThe token to convert.
Returns
- MetadataToken
The metadata token.
implicit operator MetadataToken(uint)
Converts a 32-bit unsigned integer to a metadata token.
public static implicit operator MetadataToken(uint token)
Parameters
tokenuintThe token to convert.
Returns
- MetadataToken
The metadata token.
operator !=(MetadataToken, MetadataToken)
Determines whether two metadata tokens are not considered equal. That is, either the table index or the row identifier (or both) does not match the other.
public static bool operator !=(MetadataToken a, MetadataToken b)
Parameters
aMetadataTokenThe first metadata token.
bMetadataTokenThe second metadata token.
Returns
- bool
trueif the tokens are not considered equal,falseotherwise.