❔ Can anyone break down this one-line code for me?
builder.Services.AddHttpClient<CatalogueService>(catalogueClient => { catalogueClient.BaseAddress = new Uri(""); });
builder.Services.AddHttpClient<CatalogueService>(catalogueClient => { catalogueClient.BaseAddress = new Uri(""); });
I'm following a tutorial surrounding using HttpClient properly. When adding as a service I noticed a syntax I don't think I've used before and I can't quite make sense of it. I think I understand that I'm setting the base address on the injected
catalogueClient
catalogueClient
but how is it doing it? What is
catalogueClient => { catalogueClient.BaseAddress = new Uri(""); }
catalogueClient => { catalogueClient.BaseAddress = new Uri(""); }