Ice for C\
December 19, 2025 ยท View on GitHub
Examples | Documentation | API Reference | Building from source
The Ice framework provides everything you need to build networked applications, including RPC, pub/sub, server deployment, and more.
Ice for C# is the C# (and .NET) implementation of the Ice framework.
Sample Code
// Slice definitions (Greeter.ice)
module VisitorCenter
{
/// Represents a simple greeter.
interface Greeter
{
/// Creates a personalized greeting.
/// @param name The name of the person to greet.
/// @return The greeting.
["cs:identifier:Greet"] // We prefer PascalCase for C# methods.
string greet(string name);
}
}
// Client application
using VisitorCenter;
await using var communicator = new Ice.Communicator(ref args);
GreeterPrx greeter = GreeterPrxHelper.createProxy(
communicator,
"greeter:tcp -h localhost -p 4061");
string greeting = await greeter.GreetAsync(Environment.UserName);
Console.WriteLine(greeting);
// Server application
await using var communicator = new Ice.Communicator(ref args);
Ice.ObjectAdapter adapter =
communicator.createObjectAdapterWithEndpoints("GreeterAdapter", "tcp -p 4061");
adapter.add(new Server.Chatbot(), new Ice.Identity { name = "greeter" });
adapter.activate();
Console.WriteLine("Listening on port 4061...");
Console.CancelKeyPress += (sender, eventArgs) =>
{
eventArgs.Cancel = true;
Console.WriteLine("Caught Ctrl+C, shutting down...");
communicator.shutdown();
};
await communicator.shutdownCompleted;
// Greeter implementation
using VisitorCenter;
namespace Server;
internal class Chatbot : GreeterDisp_
{
public override string Greet(string name, Ice.Current current)
{
Console.WriteLine($"Dispatching greet request {{ name = '{name}' }}");
return $"Hello, {name}!";
}
}