Get IsolatedStorageFile for current user in CSharp

Description

The following code shows how to get IsolatedStorageFile for current user.

Example


     /*  ww  w  . j  av a2 s  . c o  m*/
using System.Net;
using System;
using System.Collections;
using System.IO;
using System.IO.IsolatedStorage;
using System.Security.Policy;

class QueryIsolatedStorage
{
  public static void Main() 
  {
    IsolatedStorageFile isfs = IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
                 IsolatedStorageScope.Assembly,
                 null,
                 null);
    IEnumerator e = IsolatedStorageFile.GetEnumerator(IsolatedStorageScope.User);
    while (e.MoveNext())
    {
       IsolatedStorageFile isf = (IsolatedStorageFile) e.Current;
      Url assemblyUrl = (Url) isf.AssemblyIdentity;
      Console.WriteLine("Assembly:"+assemblyUrl.Value);
      string[] files = isf.GetFileNames("*");
      foreach (string file in files) {
        Console.WriteLine(file);
      }      
    }
  }
}

The code above generates the following result.





















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