IceRpc.Slice
0.3.1
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package IceRpc.Slice --version 0.3.1
NuGet\Install-Package IceRpc.Slice -Version 0.3.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IceRpc.Slice" Version="0.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IceRpc.Slice --version 0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IceRpc.Slice, 0.3.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IceRpc.Slice as a Cake Addin #addin nuget:?package=IceRpc.Slice&version=0.3.1 // Install IceRpc.Slice as a Cake Tool #tool nuget:?package=IceRpc.Slice&version=0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
IceRPC + Slice integration
The IceRPC framework allows you to make RPCs with the serialization format and IDL of your choice. It provides full support for both Slice and Protobuf.
The IceRpc.Slice NuGet package is part of the IceRPC + Slice integration, and includes two .NET assemblies:
- IceRpc.Slice.dll is used by the code generated by the Slice compiler for C#
- IceRpc.Slice.Generators.dll provides a source generator
Package | Source code | Documentation | Examples | API reference
Sample Code
// Slice contract
module VisitorCenter
/// Represents a simple greeter.
interface Greeter {
/// Creates a personalized greeting.
/// @param name: The name of the person to greet.
/// @returns: The greeting.
greet(name: string) -> string
}
// Client application
using IceRpc;
using VisitorCenter;
await using var connection = new ClientConnection(new Uri("icerpc://localhost"));
// GreeterProxy is a struct generated by the Slice compiler; its implementation uses
// IceRpc.Slice.
var greeter = new GreeterProxy(connection);
string greeting = await greeter.GreetAsync(Environment.UserName);
Console.WriteLine(greeting);
await connection.ShutdownAsync();
// Server application
using IceRpc;
using IceRpc.Features;
using IceRpc.Slice;
using VisitorCenter;
await using var server = new Server(new Chatbot());
server.Listen();
// Wait until the console receives a Ctrl+C.
await CancelKeyPressed;
await server.ShutdownAsync();
// IGreeterService is an interface generated by the Slice compiler.
// The [SliceService] attribute instructs the Slice Service source generator (provided by
// IceRpc.Slice.Generators.dll) to implement IDispatcher by directing "greet" requests to
// the GreetAsync method.
[SliceService]
internal partial class Chatbot : IGreeterService
{
public ValueTask<string> GreetAsync(
string name,
IFeatureCollection features,
CancellationToken cancellationToken)
{
Console.WriteLine($"Dispatching greet request {{ name = '{name}' }}");
return new($"Hello, {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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- IceRpc (= 0.3.1)
- ZeroC.Slice (= 0.3.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on IceRpc.Slice:
Package | Downloads |
---|---|
IceRpc.Locator
Locator interceptor for IceRPC |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on IceRpc.Slice:
Repository | Stars |
---|---|
icerpc/icerpc-csharp
A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
|