Add clarifying comment to HttpMethods.cs (#12441)

To help prevent well-meaning (but not actually desirable) changes like https://github.com/aspnet/AspNetCore/pull/12439
This commit is contained in:
Andrew Stanton-Nurse 2019-07-23 08:09:16 -07:00 committed by GitHub
parent 8f87e48251
commit 48b44dbb92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,14 @@ namespace Microsoft.AspNetCore.Http
{
public static class HttpMethods
{
// We are intentionally using 'static readonly' here instead of 'const'.
// 'const' values would be embedded in to each assembly that used them
// and each consuming assembly would have a different 'string' instance.
// Using .'static readonly' means that all consumers get thee exact same
// 'string' instance, which means the 'ReferenceEquals' checks below work
// and allow us to optimize comparisons when these constants are used.
// Please do NOT change these to 'const'
public static readonly string Connect = "CONNECT";
public static readonly string Delete = "DELETE";
public static readonly string Get = "GET";