# Events (/sdks/csharp/reference/events)



Events use `SendEventAsync` for publishers and `SubscribeToEventsAsync` for consumers, returning `IAsyncEnumerable` streams.

## SendEventAsync [#sendeventasync]

```csharp
await client.SendEventAsync(EventMessage message, CancellationToken ct = default);
```

**EventMessage fields:**

| Property   | Type                          | Required    | Description    |
| ---------- | ----------------------------- | ----------- | -------------- |
| `Channel`  | `string`                      | Yes         | Target channel |
| `Body`     | `ReadOnlyMemory<byte>`        | Conditional | Payload        |
| `Metadata` | `string?`                     | Conditional | Metadata       |
| `Tags`     | `Dictionary<string, string>?` | No          | Tags           |

## SubscribeToEventsAsync [#subscribetoeventsasync]

```csharp
IAsyncEnumerable<EventReceived> SubscribeToEventsAsync(
    EventsSubscription subscription, CancellationToken ct = default);
```

Returns an async stream of received events. Use `await foreach` to consume.

## Quick Usage [#quick-usage]

```csharp title="Events.cs"
await client.SendEventAsync(new EventMessage
{
    Channel = "events.demo",
    Body = new byte[] { 0x48, 0x69 },
});
```

## See Also [#see-also]

* [Events Examples](/sdks/csharp/how-to/events/)
* [Events pattern](/learn/events/getting-started)
* [C# SDK Getting Started](/sdks/csharp)
