Metadata

Wisej.AI.Embeddings.Metadata

Namespace: Wisej.AI.Embeddings

Assembly: Wisej.AI (3.5.0.0)

Represents metadata that can store key-value pairs with case-insensitive keys. Implements the ISerializable interface for JSON serialization.

public class Metadata : ISerializable

Constructors

Metadata()

Initializes a new instance of the Metadata class with empty data.

Metadata(data)

Initializes a new instance of the Metadata class with the specified initial data.

Name
Type
Description

data

Initial data to populate the metadata. If data is null, an empty metadata is created.

Metadata(data)

Initializes a new instance of the Metadata class with data from a DynamicObject.

Name
Type
Description

data

A DynamicObject containing initial data. If data is null, an empty metadata is created.

Properties

Item(name)

Object: Gets or sets the value associated with the specified name.

Throws:

  • ArgumentException Thrown when setting a value that is not of type string, number, boolean, or date.

Methods

Clone()

Creates a new instance of the Metadata class that is a copy of the current instance.

Returns: Metadata. A new Metadata object that is a copy of this instance.

This method creates a deep copy of the current metadata, allowing modifications to the clone without affecting the original.


  var original = new Metadata();
  var clone = original.Clone();

GetProperties()

Retrieves all property names within the metadata.

Returns: String[]. An array of strings containing all property names.

This method returns the keys of all stored metadata entries as an array of strings. If the metadata is empty, it returns an empty array.


  var metadata = new Metadata();
  var properties = metadata.GetProperties();

Remove(keys)

Removes metadata entries with the specified keys.

Parameter
Type
Description

keys

An array of keys identifying the metadata entries to remove.

This method will iterate through the provided keys and remove the corresponding entries from the metadata. If the metadata is empty or the keys do not exist, the method does nothing.


  var metadata = new Metadata();
  metadata["key1"] = "value1";
  metadata.Remove("key1");

Last updated