builder.Services.AddHttpClient DefaultName not clear
Type of issue
Missing information
Description
[Enter feedback here]
The way DefaultName works it's not explained at all, please add a small one-two liner example into the page on how this works and needs to be implemented
Page URL
https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.httpclientfactoryservicecollectionextensions.addhttpclient?view=net-9.0-pp&viewFallbackFrom=net-8.0#microsoft-extensions-dependencyinjection-httpclientfactoryservicecollectionextensions-addhttpclient(microsoft-extensions-dependencyinjection-iservicecollection-system-string-system-action((system-iserviceprovider-system-net-http-httpclient)))
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/Microsoft.Extensions.DependencyInjection/HttpClientFactoryServiceCollectionExtensions.xml
Document Version Independent Id
8d1c33d9-0665-bfa5-e6a2-363e28a7480a
Article author
@dotnet-bot
@silajim can you please clarify what exactly is unclear? Will linking this static property as Options.DefaultName instead of just DefaultName make it better?
Also, JFYI for HttpClientFactory we generally add all examples to the conceptual docs, so it would most possibly be added to the related section.
What I was implying is that using Options.DefaultName is not clear, it may be for someone that breathes and lives C#, but not for people that it's not their main language. While I was looking at this I had confused, since I was asking myself, "do I use DefaultName as is? do i use "" ? Do I write to Options.DefaultName and then set the name? Do I use a lambda to set it up? " In the end I had to find a 1 year old reddit post that clarified this.
I think it should also be added to the function reference since it's the first place someone will go to see what overloads are available along with some explanation on what they do.
Don't get me wrong, the examples are great, but the reference documentation is quite lacking from my point of view, in most areas. Like in the other overloads of the same page, how do they work? Like, what does the Action<IServiceProvider,HttpClient> mean? How do you set it up? More often than not, I am finding myself looking for extra resources or AI to understand these things and what should be done