C# bindings for the loro CRDT library.
Note: The current bindings are very bare bones. We are happy to accept pull requests that help make the loro API more accessible and idiomatic for C# developers!
This project provides .NET (C#) bindings for the loro CRDT library, enabling cross-platform, high-performance collaborative data structures in .NET applications. It uses Rust for the core implementation and exposes a C#-friendly API via native interop.
- Cross-platform: Supports Windows, Linux, and macOS (x64, x86, arm64)
- Modern .NET API for collaborative data structures
- Native performance via Rust FFI
- Distributed, real-time collaboration support
- Platform support: Windows, Linux, or macOS (x64, x86, arm64)
The NuGet package includes the managed C# library and native binaries for all major platforms/architectures. Install via NuGet:
dotnet add package LoroCs
using LoroCs;
using LoroCs.Extensions;
// Example usage (API subject to change)
var doc = new LoroDoc();
doc.GetMap("root".ToLoroContainerIdLike());The native library is built using Rust and UniFFI. To build native artifacts and copy them for the C# project:
pushd .\loro-cs
cargo build --release
Copy-Item .\target\release\loro_cs.dll ..\LoroCs\LoroCs\..\..\artifacts\loro_cs-win-x64\loro_cs.dll -Forcepushd ./loro-cs
cargo build --release
mkdir -p ../../artifacts/loro_cs-linux-x64-ubuntu-latest
cp ./target/release/loro_cs.so ../../artifacts/loro_cs-linux-x64/loro_cs.sopushd ./loro-cs
cargo build --release
mkdir -p ../../artifacts/loro_cs-osx-arm64-macos-latest
cp ./target/release/loro_cs.dylib ../../artifacts/loro_cs-osx-arm64/loro_cs.dylibBuild the C# project and pack the NuGet package:
dotnet build
# or to create a NuGet package:
dotnet pack
Cross-platform native builds and NuGet packaging are automated via GitHub Actions. See .github/workflows/release.yml for details.
Contributions are welcome! Please open issues or pull requests.
This project is licensed under the MIT License. See LICENSE for details.