[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThis documentation page covers the \u003ccode\u003eServiceCollectionExtensions\u003c/code\u003e static class within the Google Cloud Domains v1 API for .NET.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eServiceCollectionExtensions\u003c/code\u003e class provides methods to configure and add \u003ccode\u003eDomainsClient\u003c/code\u003e to an \u003ccode\u003eIServiceCollection\u003c/code\u003e, allowing for dependency injection.\u003c/p\u003e\n"],["\u003cp\u003eThe API offers two \u003ccode\u003eAddDomainsClient\u003c/code\u003e extension methods, one with an optional \u003ccode\u003eAction<DomainsClientBuilder>\u003c/code\u003e parameter and one with an \u003ccode\u003eAction<IServiceProvider, DomainsClientBuilder>\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the API covered in this document is 2.4.0, and previous versions down to 1.0.0 are available.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDomainsClient\u003c/code\u003e is added as a singleton to the service collection through these extension methods.\u003c/p\u003e\n"]]],[],null,["# Cloud Domains v1 API - Class ServiceCollectionExtensions (2.4.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.4.0 (latest)](/dotnet/docs/reference/Google.Cloud.Domains.V1/latest/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Domains.V1/2.3.0/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Domains.V1/2.2.0/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Domains.V1/2.1.0/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Domains.V1/2.0.0/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Domains.V1/1.0.0/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions) \n\n public static class ServiceCollectionExtensions\n\nReference documentation and code samples for the Cloud Domains v1 API class ServiceCollectionExtensions.\n\nStatic class to provide extension methods to configure API clients. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ServiceCollectionExtensions \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Microsoft.Extensions.DependencyInjection](/dotnet/docs/reference/Google.Cloud.Domains.V1/latest/Microsoft.Extensions.DependencyInjection)\n\nAssembly\n--------\n\nGoogle.Cloud.Domains.V1.dll\n\nMethods\n-------\n\n### AddDomainsClient(IServiceCollection, Action\\\u003cDomainsClientBuilder\\\u003e)\n\n public static IServiceCollection AddDomainsClient(this IServiceCollection services, Action\u003cDomainsClientBuilder\u003e action = null)\n\nAdds a singleton [DomainsClient](/dotnet/docs/reference/Google.Cloud.Domains.V1/latest/Google.Cloud.Domains.V1.DomainsClient) to `services`.\n\n### AddDomainsClient(IServiceCollection, Action\\\u003cIServiceProvider, DomainsClientBuilder\\\u003e)\n\n public static IServiceCollection AddDomainsClient(this IServiceCollection services, Action\u003cIServiceProvider, DomainsClientBuilder\u003e action)\n\nAdds a singleton [DomainsClient](/dotnet/docs/reference/Google.Cloud.Domains.V1/latest/Google.Cloud.Domains.V1.DomainsClient) to `services`."]]