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 Project File in WinRT

[TestMethod] public void ProjectFileTest() { ProjectFile(); } private async void ProjectFile() { // settings // same as (ms-appx:///MyFolder/MyFile.txt) var _Folder = Windows.ApplicationModel.Package.Current.InstalledLocation; _Folder = await _Folder.GetFolderAsync("MyFolder"); // acquire file var _File = await _Folder.GetFileAsync("MyFile.txt"); Assert.IsNotNull(_File, "Acquire File"); // write content var _WriteThis = "Hello World"; await Windows.Storage.FileIO.WriteTextAsync(_File, _WriteThis); // read content var _ReadThis = await Windows.Storage.FileIO.ReadTextAsync(_File); Assert.AreEqual(_WriteThis, _ReadThis, "Contents correct"); }
by Jerry Nixon
  June 29, 2012 @ 11:15am
by Jerry Nixon    June 03, 2013 @ 11:44am

Updated June 2013

by Aloka    November 14, 2014 @ 11:37pm

I have try this code. Is 'Assert' a key word. In my program 'Assert' is underlined as an error. how can I fixed this problem.

Add a comment

Report Abuse
brought to you by:
West Wind Techologies