Mobile 在移动应用程序(windows 8)中存储数据

Mobile 在移动应用程序(windows 8)中存储数据,mobile,windows-phone-8,isolatedstorage,Mobile,Windows Phone 8,Isolatedstorage,我需要存储一些数据以用于基于windows8的移动应用程序。数据需要重用。例如,需要存储4个电话号码以发送消息,另一个电话号码用于发送电话。我如何在这里存储数据。我听说过隔离存储。这是连接到数据库的方式还是可以连接到数据库。如果连接到数据库,应用程序会不会太重?不确定连接到数据库是什么意思 在WindowsPhone8中,独立存储是指每个应用程序在手机上的存储,我不认为我不确定其他应用程序是否可以访问它。基本上,如果你需要保存一些东西,它会是这样的。 以下代码用于保存某些内容: Isol

我需要存储一些数据以用于基于windows8的移动应用程序。数据需要重用。例如,需要存储4个电话号码以发送消息,另一个电话号码用于发送电话。我如何在这里存储数据。我听说过隔离存储。这是连接到数据库的方式还是可以连接到数据库。如果连接到数据库,应用程序会不会太重?

不确定连接到数据库是什么意思

在WindowsPhone8中,独立存储是指每个应用程序在手机上的存储,我不认为我不确定其他应用程序是否可以访问它。基本上,如果你需要保存一些东西,它会是这样的。 以下代码用于保存某些内容:

    IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();

     //create new file
     using (StreamWriter writeFile = new StreamWriter(new IsolatedStorageFileStream("myFile.txt", FileMode.Create, FileAccess.Write, myIsolatedStorage)))
{
string someTextData = "This is some text data to be saved in a new text file in the IsolatedStorage!";
writeFile.WriteLine(someTextData);
writeFile.Close();
}
要随时访问该文件,您只需执行以下操作:

    IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
    IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("myFile.txt", FileMode.Open, FileAccess.Read);
    using (StreamReader reader = new StreamReader(fileStream))
    {    //Visualize the text data in a TextBlock text
         this.text.Text = reader.ReadLine();
    }
这里是链接

隔离存储将允许您永久存储文件并在用户退出其应用程序时检索它