The library provides an idiomatic C# class hierarchy for ease of use. You can perform basic key-value operations like Put, Get, and Remove using strings or byte arrays. The library is designed to minimize buffer copying when using byte arrays. Always ensure DbOptions are configured (e.g., SetCreateIfMissing(true)) and wrap the RocksDb instance in a using block to ensure proper disposal of the unmanaged resources.
var options = new DbOptions()
.SetCreateIfMissing(true);
using (var db = RocksDb.Open(options, path))
{
// Using strings below, but can also use byte arrays for both keys and values
// much care has been taken to minimize buffer copying
db.Put("key", "value");
string value = db.Get("key");
db.Remove("key");
}