RestSharp - 如何获取数字http响应代码?

How*_*amp 12 c# http restsharp

我正在为C#使用RestSharp HTTP客户端库.

我如何检索实际的数字http响应代码?我不仅没有看到包含数字代码的属性,而且我甚至没有在header集合中看到它.

Dav*_*d L 30

只需从RestResponse对象中获取ResponseCode属性并将枚举值转换为int.

RestResponse response = client.Execute(request);
HttpStatusCode statusCode = response.StatusCode;
int numericStatusCode = (int)statusCode;
Run Code Online (Sandbox Code Playgroud)