Click or drag to resize
DigitalRuneDataStoreT Class
Stores data that can be accessed using an ID or index.
Inheritance Hierarchy
SystemObject
  DigitalRune.GameDataStoreT

Namespace: DigitalRune.Game
Assembly: DigitalRune.Game (in DigitalRune.Game.dll) Version: 1.4.0.0 (1.4.0.14427)
Syntax
public class DataStore<T>

Type Parameters

T
The type of the data items.

The DataStoreT type exposes the following members.

Constructors
  NameDescription
Public methodDataStoreT
Initializes a new instance of the DataStoreT class.
Top
Methods
  NameDescription
Public methodClear
Removes all items from the data store.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGet
Gets the item for the given ID.
Public methodGetByIndex
Gets the item at the given index.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetIdByIndex
Gets the ID of the item at the given index.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
Gets the index of the given item.
Public methodIndexOfId
Searches for the index of the item with the given ID.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove
Removes data with the given ID.
Public methodRemoveAt
Removes the item at the given index.
Public methodSet
Adds the given item to the data store.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyCount
Gets the number of items in the data store.
Top
Remarks

Data in the DataStoreT can be be accessed using an ID or index. ID: Each data item must have a unique ID. The ID is required to read/write data items. Storing a data item with a certain ID will add a new entry to the data store - or overwrite an existing entry, if an entry with for given ID already exits. Data items are sorted ascending based on their ID for fast retrieval. Accessing data items based on their ID is O(log n).

Index: Data items can also be read based on their index in the data store. However, this approach is not recommended as the index will change when data items are added or removed. Reading data based on their index is O(1).

See Also