Csharp/C Sharp by API/System.IO.IsolatedStorage/IsolatedStorageFile — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 15:13, 26 мая 2010
IsolatedStorageFile.CreateDirectory
<source lang="csharp"> using System; using System.IO; using System.IO.IsolatedStorage; static class MainClass {
static void Main() { using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForAssembly()) { store.CreateDirectory("MyFolder"); Console.WriteLine("Current size: " + store.CurrentSize.ToString()); Console.WriteLine("Scope: " + store.Scope.ToString()); } }
}
</source>
IsolatedStorageFile.GetFileNames
<source lang="csharp"> using System; using System.IO; using System.IO.IsolatedStorage; static class MainClass {
static void Main() { using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForAssembly()) { Console.WriteLine("Contained files include:"); string[] files = store.GetFileNames("*.*"); foreach (string file in files) { Console.WriteLine(file); } } }
}
</source>
IsolatedStorageFile.GetUserStoreForAssembly()
<source lang="csharp"> using System; using System.IO; using System.IO.IsolatedStorage; static class MainClass {
static void Main() { using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForAssembly()) { store.CreateDirectory("MyFolder"); using (Stream fs = new IsolatedStorageFileStream("MyFile.txt", FileMode.Create, store)) { StreamWriter w = new StreamWriter(fs); w.WriteLine("Test"); w.Flush(); } } }
}
</source>