# InboxExtensions Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.inboxextensions/)

## Register(IInbox, MessageType&lt;T&gt;, TArg, Action&lt;T, TArg, IInboxHandlerContext&gt;) {#register-2-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-f56c63b7}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.inboxextensions/methods/register-2-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-f56c63b7/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Messaging/InboxExtensions.cs)

```csharp
public static IInbox Register<T, TArg>(this IInbox inbox, MessageType<T> messageType, TArg argument, Action<T, TArg, IInboxHandlerContext> handler)
```

Registers a synchronous subject handler with an explicit argument.

### Parameters

- `inbox` (`IInbox`): The inbox.
- `messageType` (`MessageType<T>`): The subject and serializer binding.
- `argument` (`TArg`): The argument stored with the handler.
- `handler` (`Action<T, TArg, IInboxHandlerContext>`): The synchronous body, argument, and context delegate.

### Returns

The inbox.

## Register(IInbox, MessageType&lt;T&gt;, TArg, Func&lt;T, TArg, IInboxHandlerContext, CancellationToken, ValueTask&gt;) {#register-2-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-6ddde247}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.inboxextensions/methods/register-2-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-6ddde247/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Messaging/InboxExtensions.cs)

```csharp
public static IInbox Register<T, TArg>(this IInbox inbox, MessageType<T> messageType, TArg argument, Func<T, TArg, IInboxHandlerContext, CancellationToken, ValueTask> handler)
```

Registers an asynchronous subject handler with an explicit argument.

### Parameters

- `inbox` (`IInbox`): The inbox.
- `messageType` (`MessageType<T>`): The subject and serializer binding.
- `argument` (`TArg`): The argument stored with the handler.
- `handler` (`Func<T, TArg, IInboxHandlerContext, CancellationToken, ValueTask>`): The body, argument, context, and attempt-token delegate.

### Returns

The inbox.

## Register(IInbox, MessageType&lt;T&gt;, Action&lt;T, IInboxHandlerContext&gt;) {#register-1-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-e6198d22}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.inboxextensions/methods/register-1-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-e6198d22/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Messaging/InboxExtensions.cs)

```csharp
public static IInbox Register<T>(this IInbox inbox, MessageType<T> messageType, Action<T, IInboxHandlerContext> handler)
```

Registers a synchronous subject handler.

### Parameters

- `inbox` (`IInbox`): The inbox.
- `messageType` (`MessageType<T>`): The subject and serializer binding.
- `handler` (`Action<T, IInboxHandlerContext>`): The synchronous body and context delegate.

### Returns

The inbox.

## Register(IInbox, MessageType&lt;T&gt;, Func&lt;T, IInboxHandlerContext, CancellationToken, ValueTask&gt;) {#register-1-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-e3e85bce}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.inboxextensions/methods/register-1-this-orleans-durable-messaging-iinbox-orleans-durable-messaging-messa-e3e85bce/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Messaging/InboxExtensions.cs)

```csharp
public static IInbox Register<T>(this IInbox inbox, MessageType<T> messageType, Func<T, IInboxHandlerContext, CancellationToken, ValueTask> handler)
```

Registers a subject handler supporting asynchronous preparation.

### Parameters

- `inbox` (`IInbox`): The inbox.
- `messageType` (`MessageType<T>`): The subject and serializer binding.
- `handler` (`Func<T, IInboxHandlerContext, CancellationToken, ValueTask>`): The body, context, and attempt-token delegate.

### Returns

The inbox.
