ZeroC.Slice
0.4.1
Prefix Reserved
dotnet add package ZeroC.Slice --version 0.4.1
NuGet\Install-Package ZeroC.Slice -Version 0.4.1
<PackageReference Include="ZeroC.Slice" Version="0.4.1" />
paket add ZeroC.Slice --version 0.4.1
#r "nuget: ZeroC.Slice, 0.4.1"
// Install ZeroC.Slice as a Cake Addin #addin nuget:?package=ZeroC.Slice&version=0.4.1 // Install ZeroC.Slice as a Cake Tool #tool nuget:?package=ZeroC.Slice&version=0.4.1
The Slice serialization library
Slice is a serialization format for structured data: it allows you to encode structured data into streams of bytes and later decode these bytes to recreate the structured data.
Slice is also a modern Interface Definition Language (IDL): you define your structured data with the Slice IDL and then use the Slice compiler to generate code that encodes/decodes this structured data to/from bytes in Slice format.
In C#, the Slice compiler for C# generates code that relies on this Slice serialization library.
Unlike older C# libraries, Slice relies on System.Buffers (IBufferWriter<byte>
,
ReadOnlySequence<byte>
) and is typically used with the Pipelines library.
Package | Source code | Documentation | API reference
Sample Code
// Slice definition
struct Person {
name: string
id: int32
tag(1) email: string?
}
// Generated by the Slice compiler for C#
public partial record struct Person
{
public required string Name { get; set; }
public int Id { get; set; }
public string? Email { get; set; }
/// <summary>Constructs a new instance of <see cref="Person" />.</summary>
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
public Person(string name, int id, string? email)
{
this.Name = name;
...
}
/// <summary>Constructs a new instance of <see cref="Person" /> and decodes its fields
/// from a Slice decoder.</summary>
/// <param name="decoder">The Slice decoder.</param>
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
public Person(ref SliceDecoder decoder)
{
this.Name = decoder.DecodeString();
...
}
/// <summary>Encodes the fields of this struct with a Slice encoder.</summary>
/// <param name="encoder">The Slice encoder.</param>
public readonly void Encode(ref SliceEncoder encoder)
{
encoder.EncodeString(this.Name);
...
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- dunet (>= 1.11.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ZeroC.Slice:
Package | Downloads |
---|---|
IceRpc
IceRPC for C#. |
|
IceRpc.Slice
IceRpc.Slice for C#. |
GitHub repositories
This package is not used by any popular GitHub repositories.