HttpStatusCode
HttpStatusCode
, :
public string GetStatusReason(int statusCode)
{
var key = ((HttpStatusCode) statusCode).ToString();
return string.Concat(
key.Select((c, i) =>
char.IsUpper(c) && i > 0
? " " + c.ToString()
: c.ToString()
)
);
}
, :
public string GetStatusReason(int statusCode)
{
var key = ((HttpStatusCode) statusCode).ToString();
return Regex.Replace(key, "(\\B[A-Z])", " $1");
}
:
public string GetStatusReason(HttpStatusCode statusCode)
{
var key = statusCode.ToString();
return Regex.Replace(key, "(\\B[A-Z])", " $1");
}
, , , , .
source
share