Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Запись
- IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();
- string text = "";
- IsolatedStorageFileStream fs = new IsolatedStorageFileStream("text.txt", FileMode.OpenOrCreate, storage);
- // Создаем файл (либо открываем уже имеющийся)
- StreamWriter sw = new StreamWriter(fs);
- // Записываем текст в файл
- sw.Write(text);
- sw.Flush();
- // Закрываем
- sw.Close();
- // Чтение
- IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();
- try
- {
- // Создаем поток для чтения данных
- IsolatedStorageFileStream fs = new IsolatedStorageFileStream("Text\\text.txt", FileMode.Open, storage);
- StreamReader sr = new StreamReader(fs);
- // Читаем текст до конца файла
- string text = sr.ReadToEnd();
- // Закрываем поток
- sr.Close();
- } catch (Exception e) {}
Add Comment
Please, Sign In to add comment