What is the name of the syntax used in the Headers property?
Headers is defined as public HttpRequestHeaders Headers {get;}.
It hurts my head that the left side of the expression is not a setter.
I'm not finding it in hidden features of c# or History of C#
var tokenRequest = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost"),
Headers = {
{ HttpRequestHeader.Authorization.ToString(), "abc123" },
{ HttpRequestHeader.ContentType.ToString(), "application/x-www-form-urlencoded" }
},
Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["grant_type"] = "client_credentials" })
};