我在Xamarin中有一段代码从我自己的服务器获取Json输出。我想把这个输出放在一个表格中。
这是我的代码到目前为止,记录器显示Json完美的
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// Create a request for the URL.
WebRequest request = WebRequest.Create (
"http://10.190.80.248/WebService/webservice.asmx/getStudentID?id=1");
// If required by the server, set the credentials.
request.ContentType = "application/json";
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
WebResponse response = request.GetResponse ();
// Display the status.
Console.WriteLine (((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
Console.WriteLine (responseFromServer);
// Clean up the streams and the response.
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
然而,有一个问题。我希望将Json代码放入的表格被称为" SchoolTable"但无论我尝试什么,表都不会出现在代码中。通常当我输入Sc时,它会自动填写学校表。但不是现在。
如何让我的表在代码中可见并使用它来存储Json数据?