# Class GrpcChannelOptions (4.10.0)

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

- [4.10.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions)
- [4.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.Grpc.GrpcChannelOptions)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.Grpc.GrpcChannelOptions)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.Grpc.GrpcChannelOptions)
- [4.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.Grpc.GrpcChannelOptions)
- [4.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.Grpc.GrpcChannelOptions)
- [3.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.Grpc.GrpcChannelOptions)

    public sealed class GrpcChannelOptions : IEquatable<GrpcChannelOptions>

Portable abstraction of channel options

## Inheritance

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

## Implements

[IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[GrpcChannelOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions)

## Inherited Members

[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [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

[Google.Api.Gax.Grpc](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc)

## Assembly

Google.Api.Gax.Grpc.dll

## Properties

### CustomOptions

    public IReadOnlyList<GrpcChannelOptions.CustomOption> CustomOptions { get; }

Immutable list of custom options. This is never null, but may be empty.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptionshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions.CustomOption` |   |

### Empty

    public static GrpcChannelOptions Empty { get; }

An empty set of channel options.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` |   |

### EnableServiceConfigResolution

    public bool? EnableServiceConfigResolution { get; }

If non-null, explicitly enables or disables service configuration resolution.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### KeepAliveTime

    public TimeSpan? KeepAliveTime { get; }

If non-null, explicitly specifies the keep-alive period for the channel.
This specifies how often a keep-alive request is sent.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.timespan` |   |

### KeepAliveTimeout

    public TimeSpan? KeepAliveTimeout { get; }

If non-null, explicitly specifies the keep-alive timeout for the channel.
This specifies how long gRPC will wait for a keep-alive response before
assuming the channel is no longer valid, and closing it.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.timespan` |   |

### MaxReceiveMessageSize

    public int? MaxReceiveMessageSize { get; }

If non-null, explicitly specifies the maximum size in bytes that can be received from the client, per response.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### MaxSendMessageSize

    public int? MaxSendMessageSize { get; }

If non-null, explicitly specifies the maximum size in bytes that can be sent from the client, per request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### PrimaryUserAgent

    public string PrimaryUserAgent { get; }

If non-null, explicitly specifies the primary user agent for the channel.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

## Methods

### Equals(GrpcChannelOptions)

    public bool Equals(GrpcChannelOptions other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### Equals(object)

    public override bool Equals(object obj)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `obj` | `https://learn.microsoft.com/dotnet/api/system.object` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

**Overrides** [object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))

### GetHashCode()

    public override int GetHashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

**Overrides** [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

### MergedWith(GrpcChannelOptions)

    public GrpcChannelOptions MergedWith(GrpcChannelOptions overlaidOptions)

Returns a new object, with options from this object merged with `overlaidOptions`.
If an option is non-null in both objects, the one from `overlaidOptions` takes priority.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `overlaidOptions` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` The overlaid options. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new merged options. |

### WithCustomOption(CustomOption)

    public GrpcChannelOptions WithCustomOption(GrpcChannelOptions.CustomOption option)

Returns a new instance with the same options as this one, but with a new integer-valued [GrpcChannelOptions.CustomOption](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions.CustomOption)
at the end of [CustomOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_CustomOptions).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `option` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptionshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions.CustomOption` The additional custom option to include. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithCustomOption(string, int)

    public GrpcChannelOptions WithCustomOption(string name, int value)

Returns a new instance with the same options as this one, but with a new integer-valued [GrpcChannelOptions.CustomOption](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions.CustomOption)
at the end of [CustomOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_CustomOptions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the new custom option. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.int32` The value of the new custom option. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithCustomOption(string, string)

    public GrpcChannelOptions WithCustomOption(string name, string value)

Returns a new instance with the same options as this one, but with a new string-valued [GrpcChannelOptions.CustomOption](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions.CustomOption)
at the end of [CustomOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_CustomOptions).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the new custom option. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.string` The value of the new custom option. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithEnableServiceConfigResolution(bool)

    public GrpcChannelOptions WithEnableServiceConfigResolution(bool enableServiceConfigResolution)

Returns a new instance with the same options as this one, but with [EnableServiceConfigResolution](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_EnableServiceConfigResolution) set to
`enableServiceConfigResolution`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `enableServiceConfigResolution` | `https://learn.microsoft.com/dotnet/api/system.boolean` The new option for enabling service config resolution. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithKeepAliveTime(TimeSpan)

    public GrpcChannelOptions WithKeepAliveTime(TimeSpan keepAliveTime)

Returns a new instance with the same options as this one, but with [KeepAliveTime](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_KeepAliveTime) set to
`keepAliveTime`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `keepAliveTime` | `https://learn.microsoft.com/dotnet/api/system.timespan` The new keep-alive time. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithKeepAliveTimeout(TimeSpan)

    public GrpcChannelOptions WithKeepAliveTimeout(TimeSpan keepAliveTimeout)

Returns a new instance with the same options as this one, but with [KeepAliveTimeout](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_KeepAliveTimeout) set to
`keepAliveTimeout`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `keepAliveTimeout` | `https://learn.microsoft.com/dotnet/api/system.timespan` The new keep-alive timeout. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithMaxReceiveMessageSize(int)

    public GrpcChannelOptions WithMaxReceiveMessageSize(int maxReceiveMessageSize)

Returns a new instance with the same options as this one, but with [MaxReceiveMessageSize](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_MaxReceiveMessageSize) set to
`maxReceiveMessageSize`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `maxReceiveMessageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The new maximum receive message size, in bytes. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithMaxSendMessageSize(int)

    public GrpcChannelOptions WithMaxSendMessageSize(int maxSendMessageSize)

Returns a new instance with the same options as this one, but with [MaxSendMessageSize](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_MaxSendMessageSize) set to
`maxSendMessageSize`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `maxSendMessageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The new maximum send message size, in bytes. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |

### WithPrimaryUserAgent(string)

    public GrpcChannelOptions WithPrimaryUserAgent(string primaryUserAgent)

Returns a new instance with the same options as this one, but with [PrimaryUserAgent](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions#Google_Api_Gax_Grpc_GrpcChannelOptions_PrimaryUserAgent) set to
`primaryUserAgent`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `primaryUserAgent` | `https://learn.microsoft.com/dotnet/api/system.string` The new primary user agent. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.GrpcChannelOptions` | The new options. |