如何知道windows操作系统为独立存储提供的存储空间?
我能用C类中的任何方法property类来知道这一点吗?
最佳答案
您可以确定独立存储的可用空间,如下所示:
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.
}