Table of Contents

Namespace Vintagestory.API.Datastructures

Classes

ArrayAttribute<T>
BoolArrayAttribute
BoolAttribute
BoolRef
Bools
ByteArrayAttribute
CachedCuboidList
CachingConcurrentDictionary<TKey, TValue>

Exactly like ConcurrentDictionary except that Values is cached for performance, instead of building a new List each time Values is accessed

The cache is only guaranteed up to date if CachedConcurrentDictionary.TryAdd, .TryRemove or [] methods are used to modify the Dictionary otherwise the cache will be updated next time when one of those methods is used

ConcurrentDictionaryExtensions
DoubleArrayAttribute
DoubleAttribute
FastLargeSetOfLongs
FastListEnum<TElem>
FastList<TElem>

Does not clear elements in Clear(), but only sets the Count to 0

FastMemoryStream
FastSetOfInts
FastSetOfLongs
FastSmallDictionary<TKey, TValue>

A fast implementation of IDictionary using arrays. Only suitable for small dictionaries, typically 1-20 entries.
Note that Add is implemented differently from a standard Dictionary, it does not check that the key is not already present (and does not throw an ArgumentException)
Additional methods AddIfNotPresent() and Clone() are provided for convenience. There are also additional convenient constructors

FloatArrayAttribute
FloatAttribute
FloatDataMap3D

A datastructure to hold 3 dimensional data in the form of floats Can be used to perfrom trilinear interpolation between individual values

IntArrayAttribute
IntAttribute
IntDataMap2D

A datastructure to hold 2 dimensional data in the form of ints. Can be used to perfrom bilinear interpolation between individual values

IntRef
ItemstackAttribute
JsonObject

Elegant, yet somewhat inefficently designed (because wasteful with heap objects) wrapper class to abstract away the type-casting nightmare of JToken O.O

JsonTreeAttribute
LimitedDictionary<TKey, TValue>

Can only hold a limited amount of elements, discards oldest elements once the capacity is reached.

LimitedList<TElem>

Holds a limited amount of items, discards the lowest index item when an overflow happens

ListDictionary<TKey, TValue>
LongArrayAttribute
LongAttribute
OrderedDictionary<TKey, TValue>

Same as your normal C# Dictionary but ensures that the order in which the items are added is remembered. That way you can iterate over the dictionary with the insert order intact or set/get elements by index. Taken from http://www.codeproject.com/Articles/18615/OrderedDictionary-T-A-generic-implementation-of-IO Please be aware that this is not a very efficient implementation, recommed use only for small sets of data.

QueueOfInt
Rectangled
Rectanglef
RingArray<T>
RotatableCube

A rotatable version of a cuboid.

ScalarAttribute<T>
SortableQueue<T>
StackMatrix4
StringArrayAttribute
StringAttribute
SyncedTreeAttribute
TreeArrayAttribute
TreeAttribute

A datastructure to hold generic data for most primitives (int, string, float, etc.). But can also hold generic data using the ByteArrayAttribute + class serialization

TreeAttributeUtil
TreeModifiedListener
UniqueQueue<T>

Same as your normal c# queue but ensures that every element is contained only once using a Hashset.

Structs

SmallBoolArray

Suitable for up to 32 bool values, though normally used only for 6. Offers most of the methods available for a bool[], so can be dropped in to existing code

Interfaces

IAttribute

An attribute from an attribute tree

IMergeable<T>
IOrderedDictionary<TKey, TValue>

Represents a generic collection of key/value pairs that are ordered independently of the key and value.

ITreeAttribute

Represents a List of nestable Attributes

Enums

EnumAttributeType