开发者

How can I know the storage space provided by WINDOWS OS for Isolated Storage?

开发者 https://www.devze.com 2023-03-22 11:06 出处:网络
How can 开发者_C百科I know the storage space provided for Isolated Storage by Windows OS ? Can i know this by any method | property | class in C#?You can determine the available space for your isolat

How can 开发者_C百科I know the storage space provided for Isolated Storage by Windows OS ?

Can i know this by any method | property | class in C#?


You can determine the available space for your isolated storage like this:

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

public class CheckingSpace
{
    public static void Main()
    {
        // Get an isolated store for this assembly and put it into an
        // IsolatedStoreFile object.
        IsolatedStorageFile isoStore =  IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
            IsolatedStorageScope.Assembly, null, null);

        // Create a few placeholder files in the isolated store.
        new IsolatedStorageFileStream("InTheRoot.txt", FileMode.Create, isoStore);
        new IsolatedStorageFileStream("Another.txt", FileMode.Create, isoStore);
        new IsolatedStorageFileStream("AThird.txt", FileMode.Create, isoStore);
        new IsolatedStorageFileStream("AFourth.txt", FileMode.Create, isoStore);
        new IsolatedStorageFileStream("AFifth.txt", FileMode.Create, isoStore);

        Console.WriteLine(isoStore.AvailableFreeSpace + " bytes of space remain in this isolated store.");
    } // End of Main.
}


There's two answers talking about how much space. Alternatively, you might be asking about the location, which varies based on the OS:

The following table shows the root locations where isolated storage is created on a few common operating systems. Look for Microsoft\IsolatedStorage directories under this root location

If it's neither of these (space available, location), then you need to edit your question and make it clearer what information you're looking for.


IsoltaedStorage has a property AvailableFreeSpace

msdn link

0

精彩评论

暂无评论...
验证码 换一张
取 消