Enumerating Isolated Storage

An IsolatedStorageFile object also provides methods for listing files in the store:


using System;
using System.IO;
using System.IO.IsolatedStorage;

using System.Linq;
using System.Text;

class Program
{
    static void Main()
    {
        using (IsolatedStorageFile f = IsolatedStorageFile.GetUserStoreForDomain())
        {
            using (var s = new IsolatedStorageFileStream("f1.x", FileMode.Create, f))
                s.WriteByte(123);

            using (var s = new IsolatedStorageFileStream("f2.x", FileMode.Create, f))
                s.WriteByte(123);

            foreach (string s in f.GetFileNames("*.*"))
                Console.Write(s + " "); // f1.x f2.x
        }
    }
}

The output:


f1.x f2.x
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.