Access items in TeaFiles via unsafe raw memory mapping.

Namespace: TeaTime
Assembly: DiscreteLogics.TeaFiles (in DiscreteLogics.TeaFiles.dll) Version: (


public sealed class RawMemoryMapping<T> : IDisposable
where T : struct, new()

Type Parameters


[Missing <typeparam name="T"/> documentation for "T:TeaTime.RawMemoryMapping`1"]


Provides access to the item area via memory mapping. ItemAreaStart holds a raw byte pointer to the first item in the file, ItemAreaEnd a pointer past the last item. Such mapped access often provides best performance if large (many MB) or very large files (several GB or more) are accessed.

While this class can boost performance it comes with some drawbacks:
1. Usage requires unsafe context and bugs might be much harder to detect in unsafe terrain. 2. The raw byte pointers must be casted to the item type in order to access the items. 3. The TeaTime environment encourages usage of the template as item type. Pointers to this type cannot be created however. Usage of this class is therefore restricted to plain structs.

See Also