Save file to Isolated Storage File in CSharp

Description

The following code shows how to save file to Isolated Storage File.

Example


   //from ww  w.  j  a v  a 2  s. co m

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();
            }
        }
    }
}




















Home »
  C# Tutorial »
    IO »




File Attribute
File Security
Directory Attribute
Directory Recursive
Binary File
Text Field
Buffered IO
Create Copy Delete Move
CSV
Drive
File System Watcher
Isolated Storage
MemoryStream
Serialize
Zip