Table of Contents

Class Metadata

Namespace
MoonBark.GridPlacement.Core.Types
Assembly
MoonBark.GridPlacement.Core.dll

Type-safe metadata container that stores values by their type. Provides compile-time type safety and eliminates the need for string keys.

public sealed class Metadata
Inheritance
Metadata
Inherited Members

Properties

Count

Gets the count of items in the metadata.

public int Count { get; }

Property Value

int

Methods

Clear()

Clears all metadata.

public void Clear()

Clone()

Creates a copy of this metadata instance.

public Metadata Clone()

Returns

Metadata

GetOrDefault<T>()

Gets a value of type T from the metadata, or returns the default value if not found.

public T? GetOrDefault<T>() where T : notnull

Returns

T

The stored value of type T, or default(T) if not found.

Type Parameters

T

The type of value to retrieve.

Get<T>()

Gets a value of type T from the metadata.

public T Get<T>() where T : notnull

Returns

T

The stored value of type T.

Type Parameters

T

The type of value to retrieve.

Exceptions

KeyNotFoundException

Thrown when no value of type T is stored.

Has<T>()

Checks if a value of type T is stored in the metadata.

public bool Has<T>() where T : notnull

Returns

bool

True if a value of type T is stored, false otherwise.

Type Parameters

T

The type to check for.

Remove<T>()

Removes a value of type T from the metadata.

public bool Remove<T>() where T : notnull

Returns

bool

True if the value was removed, false if it didn't exist.

Type Parameters

T

The type of value to remove.

Set<T>(T)

Sets a value of type T in the metadata.

public void Set<T>(T value) where T : notnull

Parameters

value T

The value to store.

Type Parameters

T

The type of value to store.