In Windows 10 universal app there are three types of locations you can use for file operations:
- Local Folder
- Roaming Folder
- Temporary Folder
Let’s see the steps:
Create new Windows universal project and name it.
Create two buttons; one for Read and Write operation and one for TextBox to get the input from the user.
XAML Code:
- <Page.BottomAppBar>
- <AppBarIsOpen="True" IsSticky="True">
- <StackPanel Orientation="Horizontal">
- <AppBarButton Name="WriteBtn" Icon="Add" Click="WriteBtn_Click" Label="Write"></AppBarButton>
- <AppBarButton Name="readBtn" Icon="Read" Click="readBtn_Click" Label="Read"></AppBarButton>
- </StackPanel>
- </AppBar>
- </Page.BottomAppBar>
- <Grid Background="{ThemeResourceApplicationPageBackgroundThemeBrush}">
- <StackPanel>
- <TextBox x:Name="editBox"></TextBox>
- </StackPanel>
- </Grid>
- private async void WriteBtn_Click(object sender, RoutedEventArgs e)
- {
- var file = awaitApplicationData.Current.LocalFolder.CreateFileAsync("FileName.txt", CreationCollisionOption.ReplaceExisting);
- var stream = awaitfile.OpenAsync(FileAccessMode.ReadWrite);
- using(var writer = newDataWriter(stream.GetOutputStreamAt(0)))
- {
- writer.WriteString(editBox.Text.ToString());
- awaitwriter.StoreAsync();
- awaitwriter.FlushAsync();
- }
- }
- private async void readBtn_Click(object sender, RoutedEventArgs e)
- {
- var file = awaitApplicationData.Current.LocalFolder.GetFileAsync("FileName.txt");
- var stream = awaitfile.OpenAsync(FileAccessMode.Read);
- using(var reader = newDataReader(stream.GetInputStreamAt(0)))
- {
- var bytes = awaitreader.LoadAsync((uint) stream.Size);
- var s = reader.ReadString(bytes);
- MessageDialogshowDialog = newMessageDialog(s.ToString());
- showDialog.ShowAsync();
- }
- }

For more file operations like delete, rename, copy, move, etc. visit my previous article:
Read more articles on Windows 10:

Sibeesh VenuPosted Feb 18, 2016, 12:09 AM
Nice Share
Ammar ShaukatPosted Feb 17, 2016, 2:01 AM
good share . please give a small briefing on 3 types of locations you mentioned Local FolderRoaming FolderTemporary Folder
Shubham KumarPosted Feb 17, 2016, 12:06 AM
nice information
Kumaresh RajalingamPosted Feb 16, 2016, 8:00 PM
Nice
Santhakumar MunuswamyPosted Feb 16, 2016, 2:36 PM
Thanks for your sharing