小编G0l*_*ner的帖子

找不到'ApplicationException'

我的代码的打印屏幕错误和我的参考.'ApplicationException'出错,我只是不知道如何解决它.

using System;
using System.Net;
using System.Net.Http;


namespace Sharepoint_2013_REST_API
{
   public class Program
   {
       public void Main(string[] args)
        {
            //Init
            string baseURL = "hello";
            string uriString = "world";

            System.Net.Http.HttpClient _Client = new System.Net.Http.HttpClient();
            _Client.BaseAddress = new Uri(baseURL);
            HttpResponseMessage resp = _Client.GetAsync(uriString).Result;
            string respString = resp.Content.ReadAsStringAsync().Result;
            if (resp.StatusCode != HttpStatusCode.OK)
            {
                throw new ApplicationException("BAD");
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

错误通知:

错误CS0246找不到类型或命名空间名称"ApplicationException"(您是否缺少using指令或程序集引用?)25

c# throw

2
推荐指数
1
解决办法
2418
查看次数

标签 统计

c# ×1

throw ×1