I'm trying to read two header values from an HTTP method and have a few gaps in my C# knowledge. I can see a Results View in the locals when debugging and I can also see it is a System.Collections.Generic but I don't know how to access this list to obtain my two values.
Here is my Azure Function App code:
[FunctionName("Tenant")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "Tenant/{DomainName}")]HttpRequestMessage req, string DomainName, [Inject(typeof(ITableOps))]ITableOps _tableOps, TraceWriter log)
{
var headers = req.Headers;
var settings = _tableOps.GetTenantSettingsAsync(DomainName);
return req.CreateResponse(HttpStatusCode.OK, settings.Result);
}
From this key/value list I'd like to get the key named apikey and domainName and I've tried all sorts of strange ways to do this:
headers.ToList()[0]
or
var key = headers.Where(x => x.Key == "apikey")
Given the second example, key ends up being another list:
I've seen quite a few examples on using foreach loops but in my case I thought I could use a lambda to extract the value since I'm expecting two very specific key names. I realize this is easy to obtain but I'm at a loss on how to proceed.

