Friday, April 17, 2020

An extension method for HttpRequestMessage (Request in a Controller) in .NET Framework becomes an extension method for HttpRequest (Request in a Controller) in .NET Core.

internal static string GetComponentIdentifier(this HttpRequestMessage request)
{
   return request.GetHeader(HttpKeys.ComponentIdentifier);
}

 
 

What is above becomes:

internal static string GetComponentIdentifier(this HttpRequest request, StringValues x)
{
   Boolean isLegit = request.Headers.TryGetValue("ComponentIdentifier", out x);
   return x;
}

No comments:

Post a Comment