C#

USearch for C#

dotnet add package Cloud.Unum.USearch 3.0.0-rc.1 · 4c3e5023

It requires .NET 10, and the package carries the native library for Linux x64 and macOS Arm64. It exposes dense indexes; sequence, matrix and geospatial indexes follow as the C library ships them.

Topics

InstallationThe package targets net10.0, the long-term-support release supported through November 2028.
Quickstart
Executors15An executor owns host threads or device streams; an index owns entries.
Keys13Keys are 128 bits wide and render as lowercase dashed UUIDs, with integer identities parked in the low eight bytes, so 42UL converts implicitly and TryGetUInt64 reads one back.
Inputs and Outputs3Every output whose length only the call knows, such as matches, rows, products, monoliths and cursor or stream batches, lands in an Arena you pass, and the verb answers a view over it without copying.
Metrics34DenseOptions is immutable, so a variant comes from DenseOptions.Default with { ...
ResidencyWhere the payload lives is the constructor's name, as in the C lifecycle verbs, so a residency an index lacks has no constructor to call.
SerializationCheckpoints ride the SafeGraphs interchange format, and the path extension picks the layout: a .safegraphs path is one monolith, a .safegraphs.json path is a manifest cataloging many.
Filtered SearchRejected entries still route the traversal, so recall does not collapse at low selectivity.
RefinementRefinement re-selects the neighbors of every stored entry against the finished graph, improving edges that were chosen when the graph around them was still incomplete.
Linear AlgebraEvery pair a traversal scored is an exact product the caller would otherwise recompute, so Multiply hands them all back, ragged per left row, with their offsets in the arena beside them.
Retrieval and StreamingA cursor or stream keeps walk state rather than a thread, pulls on the executor of the receiver that opened it, and keeps its index alive until disposed.
Introspection7Health audits how much of the graph a search reaches from its landmarks; entries it misses stay unfound until a refinement re-links them.
ErrorsEvery failure arrives as a USearchException carrying a Status, one enumerator per usearchstatusk, such as ShapeMismatch, Io, Unsupported, or InvalidArgument.
Platform NotesEvery entry point is declared with [LibraryImport], so the marshalling stubs are source-generated and compiled in rather than reflected at runtime, and the assembly stays trimmable and ahead-of-time compilable.