Skip to content

Tomasz-Pietrzyk/BanishedDev.Libs.Data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BanishedDev.Libs.Data

License Build Status Version

A library for operations on value type data. The main task is to limit the allocation of data on Heap.

Azure DevOps coverage

NuGet Package

dotnet add package BanishedDev.Libs.Data --version 0.1.0-dev.22301201

DataCollection

DataCollection<T> where T: unmanaged

Usage

var intCollection = new DataCollection<int>(5);
var dateTimeCollection = new DataCollection<DateTime>(10);
struct dataStruct {
    public DateTime timestamp { get; set; }
    public decimal price { get; set; }
}

var dataStructCollection = new DataCollection<dataStruct>(100);

IDisposable

Data Collection allocates 40 bytes. Data that is stored in native memory that dynamically allocates. Calling Dispose frees memory immediately.

intCollection.Dispose();
dateTimeCollection.Dispose();
dataStructCollection.Dispose();

Methods

void Add(T element);
bool Remove(T element);
int IndexOf(T element);
bool Contains(T element);

Properties

int Count { get; }
T this[int index] { get; }

JsonSerialization

var string = JsonSerializer.Serialize(dataStructCollection);
[
    {
        "timestamp":"",
        "price":1.04
    },
    {
        "timestamp":"",
        "price":1.04
    }
]

About

ClassLibrary for processing ValueType data without allocating on Heap.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages