# Class ClientBase&lt;T&gt; (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.ClientBase-1)
- [2.63.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.ClientBase-1)
- [2.48.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.ClientBase-1)

    public abstract class ClientBase<T> : ClientBase where T : ClientBase<T>

Generic base class for client-side stubs.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [ClientBase](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase) \> ClientBase\<T\>

## Inherited Members

[ClientBase.CallInvoker](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase#Grpc_Core_ClientBase_CallInvoker) [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](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)

## Assembly

Grpc.Core.Api.dll

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `T` |   |

## Constructors

### ClientBase()

    protected ClientBase()

Initializes a new instance of `ClientBase` class that
throws `NotImplementedException` upon invocation of any RPC.
This constructor is only provided to allow creation of test doubles
for client classes (e.g. mocking requires a parameterless constructor).

### ClientBase(CallInvoker)

    public ClientBase(CallInvoker callInvoker)

Initializes a new instance of `ClientBase` class.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `callInvoker` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker` The `CallInvoker` for remote call invocation. |

### ClientBase(ChannelBase)

    public ClientBase(ChannelBase channel)

Initializes a new instance of `ClientBase` class.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `channel` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ChannelBase` The channel to use for remote call invocation. |

### ClientBase(ClientBaseConfiguration)

    protected ClientBase(ClientBase.ClientBaseConfiguration configuration)

Initializes a new instance of `ClientBase` class.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `configuration` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBasehttps://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.ClientBaseConfiguration` The configuration. |

## Methods

### NewInstance(ClientBaseConfiguration)

    protected abstract T NewInstance(ClientBase.ClientBaseConfiguration configuration)

Creates a new instance of client from given `ClientBaseConfiguration`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `configuration` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBasehttps://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.ClientBaseConfiguration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` |   |

### WithHost(string)

    public T WithHost(string host)

Creates a new client that sets host field for calls explicitly.
gRPC supports multiple "hosts" being served by a single server.
By default (if a client was not created by calling this method),
host `null` with the meaning "use default host" is used.

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` |   |