我有一个函数可以在类中返回类型对象。它适用于网页,但不适用于 windows phone 应用程序。错误是“预期的类、委托、枚举、接口或结构”。谁能告诉我如何解决它。谢谢。
有我的代码:
public static object GetData(Uri relativeUri)
{
return GetData<object>(relativeUri);
}
public static T GetData<T>(Uri relativeUri)
{
var request = CreateRequest(relativeUri);
HttpWebResponse r;
//return Deserializer<T>(request.GetResponse().GetResponseStream());
try
{
r = (HttpWebResponse)request.GetResponse();
return Deserializer<T>(r.GetResponseStream());
}
catch (WebException webex)
{
HttpWebResponse webResp = (HttpWebResponse)webex.Response;
setSessionError(webResp.GetResponseStream());
}
return Deserializer<T>(request.GetResponse().GetResponseStream());
}