📄 class1.cs
字号:
using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections;
namespace Iso
{
public class IsoApp
{
[STAThread]
public static void Main()
{
// Get an isolated store for this assembly
IsolatedStorageFile iso =
IsolatedStorageFile.GetStore(
IsolatedStorageScope.User |
IsolatedStorageScope.Assembly,
null, null);
// Create a few files so that they can be enumerated.
IsolatedStorageFileStream s1 =
new IsolatedStorageFileStream(
"Foo1.Txt", FileMode.Create, iso);
IsolatedStorageFileStream s2 =
new IsolatedStorageFileStream(
"Foo2.Txt", FileMode.Create, iso);
IsolatedStorageFileStream s3 =
new IsolatedStorageFileStream(
"Foo3.Txt", FileMode.Create, iso);
s1.Close();
s2.Close();
s3.Close();
// There might be a small delay before the files are created
// in the store - closing and opening the store ensures that
// the CLR has finished creating the files.
iso.Close();
iso = IsolatedStorageFile.GetStore(
IsolatedStorageScope.User |
IsolatedStorageScope.Assembly,
null, null);
// Put all the files in iso into an IEnumerator.
IEnumerator e = IsolatedStorageFile.GetEnumerator(
IsolatedStorageScope.User);
long total = 0;
// Add up the sizes of all the stores.
while (e.MoveNext())
{
IsolatedStorageFile store =
(IsolatedStorageFile)e.Current;
total += (long)store.CurrentSize;
}
Console.WriteLine("Total size = " + total);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -