# Class CallInvokerExtensions (2.66.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.66.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Interceptors.CallInvokerExtensions)
- [2.63.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.Interceptors.CallInvokerExtensions)
- [2.48.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.Interceptors.CallInvokerExtensions)

    public static class CallInvokerExtensions

Extends the CallInvoker class to provide the interceptor facility on the client side.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> CallInvokerExtensions

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Grpc.Core.Interceptors](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Interceptors)

## Assembly

Grpc.Core.Api.dll

## Methods

### Intercept(CallInvoker, Interceptor)

    public static CallInvoker Intercept(this CallInvoker invoker, Interceptor interceptor)

Returns a [CallInvoker](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker) instance that intercepts
the invoker with the given interceptor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `invoker` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker` The underlying invoker to intercept. |
| `interceptor` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Interceptors.Interceptor` The interceptor to intercept calls to the invoker with. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker` |   |

**Remarks** Multiple interceptors can be added on top of each other by calling
"invoker.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c".
Interceptors can be later added to an existing intercepted CallInvoker, effectively
building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that
in this case, the last interceptor added will be the first to take control.

### Intercept(CallInvoker, params Interceptor\[\])

    public static CallInvoker Intercept(this CallInvoker invoker, params Interceptor[] interceptors)

Returns a [CallInvoker](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker) instance that intercepts
the invoker with the given interceptors.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `invoker` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker` The channel to intercept. |
| `interceptors` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Interceptors.Interceptor` An array of interceptors to intercept the calls to the invoker with. Control is passed to the interceptors in the order specified. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker` |   |

**Remarks** Multiple interceptors can be added on top of each other by calling
"invoker.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c".
Interceptors can be later added to an existing intercepted CallInvoker, effectively
building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that
in this case, the last interceptor added will be the first to take control.

### Intercept(CallInvoker, Func\<Metadata, Metadata\>)

    public static CallInvoker Intercept(this CallInvoker invoker, Func<Metadata, Metadata> interceptor)

Returns a [CallInvoker](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker) instance that intercepts
the invoker with the given interceptor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `invoker` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker` The underlying invoker to intercept. |
| `interceptor` | `https://learn.microsoft.com/dotnet/api/system.func-2https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadatahttps://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata` An interceptor delegate that takes the request metadata to be sent with an outgoing call and returns a [Metadata](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata) instance that will replace the existing invocation metadata. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker` |   |

**Remarks** Multiple interceptors can be added on top of each other by
building a chain like "invoker.Intercept(c).Intercept(b).Intercept(a)". Note that
in this case, the last interceptor added will be the first to take control.