我使用 RestSharp 来使用 Restful WCF,它在我的子路由中运行良好。
string baseUrl = "12.34.56.789/MyServices";
RestClient client = new RestClient("http://" + baseUrl + "/MyData.svc");
var request = new RestRequest(Method.GET);
request.Resource = "/GetProblemId";
request.AddParameter("problemId", "1");
var response = client.Execute(request);
var problems = JsonConvert.DeserializeObject<List<ProblemTypeDTO>>(response.Content);
现在我必须以不同的方法访问问题,所以我想将它设置为一个全局对象。但我不能将其声明为
private static var problems;
解决办法是什么?