DocFX + Singulink = ♥

Class Data<THolder, TValue>

Stores TValues associated with THolders.

Inheritance
object
Data
Data<THolder, TValue>
GameData<TValue>
PlayerData<TValue>
Inherited Members
Data.TryUnbox<T>(StrongBox<T>, out T)
Data.RequiredFeature
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SlugBase.Features
Assembly: SlugBase.dll
Syntax
public class Data<THolder, TValue> : Data where THolder : class where TValue : new()
Type Parameters
Name Description
THolder

The key type that values are associated with.

TValue

The type of data stored.

Remarks

PlayerData<TValue> and GameData<TValue> should be used when possible. Otherwise, consider making a child class with Get and TryGet methods that find the most appropriate SlugBaseCharacter to pass to Get(SlugBaseCharacter, THolder).

Constructors

View Source

Data(Feature)

Creates a new instance of Data<THolder, TValue> that depends on requiredFeature.

Declaration
public Data(Feature requiredFeature)
Parameters
Type Name Description
Feature requiredFeature

The required Feature, or null if data access should not be locked behind a feature.

Methods

View Source

Get(SlugBaseCharacter, THolder)

Gets the TValue instance assocated with key, constructing it if it does not exist.

If character does not have RequiredFeature, then null is returned.

Declaration
public StrongBox<TValue> Get(SlugBaseCharacter character, THolder key)
Parameters
Type Name Description
SlugBaseCharacter character

The SlugBaseCharacter that may own RequiredFeature.

THolder key

The key the data is attached to.

Returns
Type Description
StrongBox<TValue>