# Client (/sdks/csharp/reference/client)



`KubeMQClient` targets modern .NET with async-first APIs and `IAsyncDisposable` for cleanup.

## Package [#package]

```bash
dotnet add package KubeMQ.SDK.CSharp
```

Requires .NET 8.0 (LTS).

## Constructor [#constructor]

```csharp
var client = new KubeMQClient(KubeMQClientOptions options);
```

**Parameters:**

| Name      | Type                  | Required | Description                                |
| --------- | --------------------- | -------- | ------------------------------------------ |
| `options` | `KubeMQClientOptions` | Yes      | Address, TLS, auth, timeouts, retry policy |

## ConnectAsync [#connectasync]

```csharp
await client.ConnectAsync(CancellationToken ct = default);
```

Establishes the gRPC connection; throws `KubeMQConnectionException` when the broker cannot be reached within the timeout.

## DisposeAsync [#disposeasync]

```csharp
await client.DisposeAsync();
```

Prefer `await using` for deterministic cleanup:

```csharp
await using var client = new KubeMQClient(new KubeMQClientOptions { /* ... */ });
await client.ConnectAsync();
```

## Quick Usage [#quick-usage]

```csharp title="Program.cs"
await using var client = new KubeMQClient(new KubeMQClientOptions
{
    Address = "localhost:50000",
    ClientId = "csharp-demo",
});

await client.ConnectAsync();
```

## See Also [#see-also]

* [Connection Examples](/sdks/csharp/how-to/connection/)
* Concepts
* [C# SDK Getting Started](/sdks/csharp)
