Class VariantMetadataBuilder
Collects unique field names and builds the sorted binary metadata dictionary used by variant objects.
public sealed class VariantMetadataBuilder
- Inheritance
-
VariantMetadataBuilder
- Inherited Members
Properties
Count
Gets the number of unique field names.
public int Count { get; }
Property Value
Methods
Add(string)
Adds a field name to the dictionary. Returns the assigned field ID. If the name already exists, returns the existing ID.
public int Add(string name)
Parameters
namestring
Returns
Build()
Builds the binary metadata. Use this overload when you don't need the ID remap.
public byte[] Build()
Returns
- byte[]
Build(out int[])
Builds the binary metadata with the dictionary sorted by UTF-8 byte order.
public byte[] Build(out int[] idRemap)
Parameters
idRemapint[]Maps original (insertion-order) field IDs to sorted field IDs. idRemap[originalId] = sortedId.
Returns
- byte[]
The binary metadata bytes.
CollectFieldNames(VariantReader)
Recursively walks source and adds every field name it
references to this builder. Use during the metadata-collection phase of
a two-pass encode — build the metadata first, finalize it via
Build(out int[]), then pass the resulting remap to a
VariantValueWriter and call CopyValue(VariantReader).
public void CollectFieldNames(VariantReader source)
Parameters
sourceVariantReader
GetId(string)
Gets the field ID for an already-added name.
public int GetId(string name)
Parameters
namestring