相关疑难解决方法(0)

C#中的例外有多贵?

C#中的例外有多贵?只要堆叠不深,它们似乎并不是非常昂贵; 但我读过相互矛盾的报道.

有没有被反驳的确定性报告?

c# exception

70
推荐指数
5
解决办法
3万
查看次数

HttpResponseMessage和HttpResponseException有什么区别

我试着理解这两个并编写示例代码:

 public HttpResponseMessage Get()
 {
     var response = ControllerContext.Request
                         .CreateResponse(HttpStatusCode.BadRequest, "abc");

     throw new HttpResponseException(response);
 }
Run Code Online (Sandbox Code Playgroud)

和:

 public HttpResponseMessage Get()
 {
     return ControllerContext.Request
                        .CreateResponse(HttpStatusCode.BadRequest, "abc");
 }
Run Code Online (Sandbox Code Playgroud)

从小提琴,我真的没有看到它们之间有任何差异,那么使用的目的是HttpResponseException什么?

c# asp.net-web-api

57
推荐指数
3
解决办法
5万
查看次数

标签 统计

c# ×2

asp.net-web-api ×1

exception ×1