Table of Contents

Class DistinctMetadataTableBuffer<TRow>

Namespace
AsmResolver.DotNet.Builder.Metadata
Assembly
AsmResolver.DotNet.dll

Decorates a metadata table buffer with a filter that removes all duplicated rows from the buffer.

public class DistinctMetadataTableBuffer<TRow> : IMetadataTableBuffer<TRow>, IMetadataTableBuffer where TRow : struct, IMetadataRow

Type Parameters

TRow

The type of rows to store.

Inheritance
DistinctMetadataTableBuffer<TRow>
Implements
Inherited Members

Constructors

DistinctMetadataTableBuffer(IMetadataTableBuffer<TRow>)

Creates a new distinct metadata table buffer decorator.

public DistinctMetadataTableBuffer(IMetadataTableBuffer<TRow> underlyingBuffer)

Parameters

underlyingBuffer IMetadataTableBuffer<TRow>

The underlying table buffer.

Properties

Count

Gets the number of rows that were added to the buffer.

public int Count { get; }

Property Value

int

this[uint]

Gets or sets a row in the metadata table.

public TRow this[uint rid] { get; set; }

Parameters

rid uint

The identifier of the metadata row.

Property Value

TRow

Methods

Add(in TRow)

Adds a row to the metadata table.

public MetadataToken Add(in TRow row)

Parameters

row TRow

The row to add.

Returns

MetadataToken

The metadata token that this row was assigned to.

Add(in TRow, bool)

Adds a row to the metadata table buffer.

public MetadataToken Add(in TRow row, bool allowDuplicates)

Parameters

row TRow

The row to add.

allowDuplicates bool

true if the row is always to be added to the end of the buffer, false if a duplicated row is supposed to be removed and the token of the original should be returned instead.

Returns

MetadataToken

The metadata token that this row was assigned to.

Clear()

Clears the table buffer.

public void Clear()

EnsureCapacity(int)

Ensures the capacity of the table buffer is at least the provided amount of elements.

public void EnsureCapacity(int capacity)

Parameters

capacity int

The number of elements to store.

FlushToTable()

Submits all rows to the underlying table stream.

public void FlushToTable()

GetRowRef(uint)

Gets or sets a reference to a row in the metadata table.

public ref TRow GetRowRef(uint rid)

Parameters

rid uint

The identifier of the metadata row.

Returns

TRow

Insert(uint, in TRow)

Inserts a row into the metadata table at the provided row identifier.

public MetadataToken Insert(uint rid, in TRow row)

Parameters

rid uint

The row identifier.

row TRow

The row to add.

Returns

MetadataToken

The metadata token that this row was assigned to.

Insert(uint, in TRow, bool)

Inserts a row into the metadata table at the provided row identifier.

public MetadataToken Insert(uint rid, in TRow row, bool allowDuplicates)

Parameters

rid uint

The row identifier.

row TRow

The row to add.

allowDuplicates bool

true if the row is always to be added to the end of the buffer, false if a duplicated row is supposed to be removed and the token of the original should be returned instead.

Returns

MetadataToken

The metadata token that this row was assigned to.