CodePaste Logo
New Snippet New Recent Snippets Recent Snippets My Snippets My Snippets My Favorites Favorites Web Code Search Snippets Search
Sign inor Register
Language: csharp

Read IsolatedStorage File in WinRT

2517 Views   
[TestMethod] public void IsolatedStorageTest() { IsolatedStorage(); } public async void IsolatedStorage() { // settings var _Name = "MyFileName"; var _Folder = Windows.Storage.ApplicationData.Current.LocalFolder; var _Option = Windows.Storage.CreationCollisionOption.ReplaceExisting; // create file var _File = await _Folder.CreateFileAsync(_Name, _Option); Assert.IsNotNull(_File, "Create file"); // write content var _WriteThis = "Hello world!"; await Windows.Storage.FileIO.WriteTextAsync(_File, _WriteThis); // acquire file _File = await _Folder.GetFileAsync(_Name); Assert.IsNotNull(_File, "Acquire file"); // read content var _ReadThis = await Windows.Storage.FileIO.ReadTextAsync(_File); Assert.AreEqual(_WriteThis, _ReadThis, "Contents match"); }
by Jerry Nixon
  June 29, 2012 @ 10:44am
Tags:
Add a comment


Report Abuse
brought to you by:
West Wind Techologies