将其转换为int类型: HttpStatusCode statusCode = HttpStatusCode.NotFound; int codeAsInteger = (int)statusCode; 现在,codeAsInteger 的值为 404。