为什么System.Net.Http.HttpMethod是类而不是枚举?
问题描述:
HttpStatusCode
被实现为enum
,每个可能的值都分配给其相应的HTTP状态代码(例如(int)HttpStatusCode.Ok == 200
).
HttpStatusCode
is implemented as an enum
, with each possible value assigned to its corresponding HTTP status code (e.g. (int)HttpStatusCode.Ok == 200
).
However, HttpMethod
is implemented as a class
, with static properties to get instances for the various HTTP verbs (HttpStatus.GET
, HttpStatus.PUT
etc). What is the rationale behind not implementing HttpMethod
as an enum
?