Answered by:
i have not system.io.File !

Question
-
hi
i add using System.IO
but when i type dot after IO file not show File.WriteAllLines
(windows store c#)
why i haveny it?
is any thing replace it?
my code is :
List<string> myList = new List<string>(); myList.Add(TextBox.Text);
string path = "D:\\Temp\\MyFile.txt"; File.WriteAllLines(path, myList);
Amir Ameri
Thursday, December 11, 2014 5:04 PM
Answers
-
You cannot access the .NET objects and extensions that are not part of WinRT. See this for available system.io namespace objects and methods: http://msdn.microsoft.com/en-us/library/windows/apps/hh454050.aspx
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Thursday, December 11, 2014 7:34 PM
- Marked as answer by Jamles HezModerator Monday, December 22, 2014 9:47 AM
Thursday, December 11, 2014 7:33 PMModerator -
Hi Amir,
We have many samples on file access so please review those and you will be the master of all things File related!
File access and File Picker samples will be probably all you need.
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)- Marked as answer by Jamles HezModerator Monday, December 22, 2014 9:47 AM
Friday, December 12, 2014 5:15 PMModerator
All replies
-
You cannot access the .NET objects and extensions that are not part of WinRT. See this for available system.io namespace objects and methods: http://msdn.microsoft.com/en-us/library/windows/apps/hh454050.aspx
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Thursday, December 11, 2014 7:34 PM
- Marked as answer by Jamles HezModerator Monday, December 22, 2014 9:47 AM
Thursday, December 11, 2014 7:33 PMModerator -
tank you for your help.
i have a list view that i want save it to a txt file in window store C#
i write this code for it
private async void Button_Click(object sender, RoutedEventArgs e)
{
string fileName = "test.txt";
string text = ageTextBox.Text;
IStorageFolder applicationFolder = ApplicationData.Current.LocalFolder;
IStorageFile storageFile = await applicationFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
using (Stream stream = await storageFile.OpenStreamForWriteAsync())
{
byte[] content = Encoding.UTF8.GetBytes(text);
await stream.WriteAsync(content, 0, content.Length);
}of course in this code i test textbox.
when i run it and click button dont appear any error.but i dont found any file that name is test.txt in my pc.
is this code correct or no.and if i want that choose folder to save file what i do ?
tank you very much
Amir Ameri
Thursday, December 11, 2014 7:52 PM -
Hi Amir,
We have many samples on file access so please review those and you will be the master of all things File related!
File access and File Picker samples will be probably all you need.
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)- Marked as answer by Jamles HezModerator Monday, December 22, 2014 9:47 AM
Friday, December 12, 2014 5:15 PMModerator