I would like to build an in-memory table data structure with 4 columns so I can look up values based on any combination of the columns (using linq for example). Is there a built-in data type for this or do I have to craft one myself (obviously I can't)?
In-memory databases are purpose-built databases that rely primarily on memory for data storage, in contrast to databases that store data on disk or SSDs. In-memory data stores are designed to enable minimal response times by eliminating the need to access disks.
In-memory optimized table—data is stored in the data and delta file pairs. It is also called a checkpoint-file-pair (CFP). The data file is used to store DML commands and the delta file is used for deleted rows. During DML operations many CFPs will be created, this causes increased recovery time and disk space usage.
The representation of particular data structure in the main memory of a computer is called as storage structure. For Examples: Array, Stack, Queue, Tree, Graph, etc.
It means that each time you query a database or update data in a database, you only access the main memory. So, there's no disk involved into these operations. And this is good, because the main memory is way faster than any disk. A good example of such a database is Memcached.
Unless you have something specific in mind, I would declare a type with 4 properties with suitable names and types, i.e.
public class SomethingSuitable {
public int Foo {get;set;}
public string Bar {get;set;}
public DateTime Blap {get;set;}
public float Blip {get;set;}
}
and use any list/array/dictionary etc as necessary, or just
data.Single(x => x.Bar == "abc");
etc.
Check DataTable class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With