# GDC Hardware Management v1alpha API - Class ServiceCollectionExtensions (1.0.0-alpha08)

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

- [1.0.0-alpha08 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.GdcHardwareManagement.V1Alpha/latest/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)
- [1.0.0-alpha07](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.GdcHardwareManagement.V1Alpha/1.0.0-alpha07/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)

    public static class ServiceCollectionExtensions

Reference documentation and code samples for the GDC Hardware Management v1alpha API class ServiceCollectionExtensions.

Static class to provide extension methods to configure API clients.

## Inheritance

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

## Inherited Members

[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.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Microsoft.Extensions.DependencyInjection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.GdcHardwareManagement.V1Alpha/latest/Microsoft.Extensions.DependencyInjection)

## Assembly

Google.Cloud.GdcHardwareManagement.V1Alpha.dll

## Methods

### AddGDCHardwareManagementClient(IServiceCollection, Action\<GDCHardwareManagementClientBuilder\>)

    public static IServiceCollection AddGDCHardwareManagementClient(this IServiceCollection services, Action<GDCHardwareManagementClientBuilder> action = null)

Adds a singleton [GDCHardwareManagementClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.GdcHardwareManagement.V1Alpha/latest/Google.Cloud.GdcHardwareManagement.V1Alpha.GDCHardwareManagementClient) to `services`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `services` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` The service collection to add the client to. The services are used to configure the client when requested. |
| `action` | `https://learn.microsoft.com/dotnet/api/system.action-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.GdcHardwareManagement.V1Alpha/latest/Google.Cloud.GdcHardwareManagement.V1Alpha.GDCHardwareManagementClientBuilder` An optional action to invoke on the client builder. This is invoked before services from `services` are used. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` |   |

### AddGDCHardwareManagementClient(IServiceCollection, Action\<IServiceProvider, GDCHardwareManagementClientBuilder\>)

    public static IServiceCollection AddGDCHardwareManagementClient(this IServiceCollection services, Action<IServiceProvider, GDCHardwareManagementClientBuilder> action)

Adds a singleton [GDCHardwareManagementClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.GdcHardwareManagement.V1Alpha/latest/Google.Cloud.GdcHardwareManagement.V1Alpha.GDCHardwareManagementClient) to `services`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `services` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` The service collection to add the client to. The services are used to configure the client when requested. |
| `action` | `https://learn.microsoft.com/dotnet/api/system.action-2System.IServiceProviderhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.GdcHardwareManagement.V1Alpha/latest/Google.Cloud.GdcHardwareManagement.V1Alpha.GDCHardwareManagementClientBuilder` An optional action to invoke on the client builder. This is invoked before services from `services` are used. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` |   |