C# 创建代码中不可见的表(Xamarin)
我在Xamarin中有一段代码,它从我自己的服务器获取Json输出。我想把这个输出放到一个表中 这是到目前为止我的代码,记录器显示了Json perfectyC# 创建代码中不可见的表(Xamarin),c#,json,xamarin,C#,Json,Xamarin,我在Xamarin中有一段代码,它从我自己的服务器获取Json输出。我想把这个输出放到一个表中 这是到目前为止我的代码,记录器显示了Json perfecty public class Application { // This is the main entry point of the application. static void Main (string[] args) { // Create a request for the URL.
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时,它会自动填充Schooltable。但现在不行
如何使我的表在代码中可见,并使用它将Json数据存储到表中?那么您遇到了代码自动完成问题还是什么?不,在自动完成工作之前,您必须在Xamarin中执行某些操作(如链接表和代码)。我想念那个“链接”。我似乎无法修复它为什么要将所有这些代码都放在Main.cs中?此时UI尚未初始化,无法访问。Xamarin有几十个教程和示例应用程序,您可以查看这些教程和示例应用程序,了解如何正确构造应用程序和使用TableView。