Table of Contents

Class GenericDataHolder

Namespace
MLEM.Misc
Assembly
MLEM.dll

Represents an object that can hold generic key-value based data. A lot of MLEM components extend this class to allow for users to add additional data to them easily. This IGenericDataHolder implemention uses an underlying Dictionary<TKey, TValue> that only keeps track of non-default values.

public class GenericDataHolder : IGenericDataHolder
Inheritance
GenericDataHolder
Implements
Derived
Inherited Members
Extension Methods

Methods

GetDataKeys()

Returns all of the generic data that this object stores.

public IEnumerable<string> GetDataKeys()

Returns

IEnumerable<string>

The generic data on this object

GetData<T>(string)

Returns a piece of generic data of the given type on this object.

public T GetData<T>(string key)

Parameters

key string

The key that the data is stored by

Returns

T

The data, or default if it doesn't exist

Type Parameters

T

The type of the data stored

SetData(string, object)

Store a piece of generic data on this object.

[Obsolete("This method will be removed in a future update in favor of the generic SetData<T>.")]
public void SetData(string key, object data)

Parameters

key string

The key to store the data by

data object

The data to store in the object

SetData<T>(string, T)

Store a piece of generic data on this object.

public void SetData<T>(string key, T data)

Parameters

key string

The key to store the data by

data T

The data to store in the object

Type Parameters

T