Struct MethodDefinitionRow
- Namespace
- AsmResolver.PE.DotNet.Metadata.Tables
- Assembly
- AsmResolver.PE.dll
Represents a single row in the method definition metadata table.
public struct MethodDefinitionRow : IMetadataRow, IReadOnlyList<uint>, IReadOnlyCollection<uint>, IEnumerable<uint>, IEnumerable, IEquatable<MethodDefinitionRow>
- Implements
- Inherited Members
Constructors
MethodDefinitionRow(ISegmentReference, MethodImplAttributes, MethodAttributes, uint, uint, uint)
Creates a new row for the method definition metadata table.
public MethodDefinitionRow(ISegmentReference body, MethodImplAttributes implAttributes, MethodAttributes attributes, uint name, uint signature, uint parameterList)
Parameters
body
ISegmentReferenceThe reference to the beginning of the method body.
implAttributes
MethodImplAttributesThe characteristics of the implementation of the method body.
attributes
MethodAttributesThe attributes associated to the method.
name
uintThe index into the #Strings heap containing the name of the type reference.
signature
uintThe index into the #Blob heap containing the signature of the method.
parameterList
uintThe index into the Param (or ParamPtr) table, representing the first parameter that this method defines.
Properties
Attributes
Gets or sets the attributes associated to the method.
public MethodAttributes Attributes { readonly get; set; }
Property Value
Body
Gets a reference to the beginning of the method body.
public ISegmentReference Body { readonly get; set; }
Property Value
Remarks
This field deviates from the original specification as described in ECMA-335. It replaces the RVA column of the method definition row. Only the RVA of this reference is only considered when comparing two method definition rows for equality.
If this value is null, the method does not define any method body.
Count
Gets the number of elements in the collection.
public int Count { get; }
Property Value
- int
The number of elements in the collection.
ImplAttributes
Gets or sets the characteristics of the implementation of the method body.
public MethodImplAttributes ImplAttributes { readonly get; set; }
Property Value
Remarks
These attributes dictate the format of Body.
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.
Name
Gets or sets an index into the #Strings heap containing the name of the type reference.
public uint Name { readonly get; set; }
Property Value
Remarks
This value should always index a non-empty string.
ParameterList
Gets or sets an index into the Param (or ParamPtr) table, representing the first parameter that this method defines.
public uint ParameterList { readonly get; set; }
Property Value
Signature
Gets or sets an index into the #Blob heap containing the signature of the method. This includes the return type, as well as parameter types.
public uint Signature { readonly get; set; }
Property Value
Remarks
This value should always index a valid method signature.
TableIndex
Gets or sets the index of the table that this row is stored in.
public TableIndex TableIndex { get; }
Property Value
Methods
Equals(MethodDefinitionRow)
Determines whether this row is considered equal to the provided method definition row.
public bool Equals(MethodDefinitionRow other)
Parameters
other
MethodDefinitionRowThe other row.
Returns
- bool
true
if the rows are equal,false
otherwise.
Remarks
When comparing both method bodies, only the RVA is considered in this equality test. The exact type is ignored.
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(MetadataReaderContext, ref BinaryStreamReader, TableLayout)
Reads a single method definition row from an input stream.
public static MethodDefinitionRow FromReader(MetadataReaderContext context, ref BinaryStreamReader reader, TableLayout layout)
Parameters
context
MetadataReaderContextThe reader context.
reader
BinaryStreamReaderThe input stream.
layout
TableLayoutThe layout of the method definition table.
Returns
- MethodDefinitionRow
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 ==(MethodDefinitionRow, MethodDefinitionRow)
Determines whether two rows are considered equal.
public static bool operator ==(MethodDefinitionRow left, MethodDefinitionRow right)
Parameters
left
MethodDefinitionRowright
MethodDefinitionRow
Returns
operator !=(MethodDefinitionRow, MethodDefinitionRow)
Determines whether two rows are not considered equal.
public static bool operator !=(MethodDefinitionRow left, MethodDefinitionRow right)
Parameters
left
MethodDefinitionRowright
MethodDefinitionRow