次の方法で共有


IsolatedStorageFile.CurrentSize プロパティ

分離ストレージの現在のサイズを取得します。

<CLSCompliant(False)>
Overrides Public ReadOnly Property CurrentSize As UInt64
[C#]
[CLSCompliant(false)]
public override ulong CurrentSize {get;}
[C++]
[CLSCompliant(false)]
public: __property unsigned __int64 get_CurrentSize();
[JScript]
public
   CLSCompliant(false)
override function get CurrentSize() : UInt64;

プロパティ値

分離ストレージのスコープ内で現在使用されているストレージの合計バイト数。

例外

例外の種類 条件
InvalidOperationException プロパティが使用できません。現在のストアは、ローミング スコープが指定されているか、または開いていません。

解説

分離ストレージのスコープ内にあるすべてのファイルとディレクトリによるストレージ使用率の合計を表します。

ローミング ユーザー プロファイルに関連しているストアについては、現在のサイズを正確には確認できません。ローミング プロファイルは、複数のクライアント コンピュータでキャッシュに保存され、後からサーバーと同期されることが多いため、このようなストアにはクォータを強制的に適用できません。また、現在のサイズもレポートされません。

CurrentSize プロパティの使用方法については、「 領域の状態による予測 」の例を参照してください。

使用例

[Visual Basic, C#, C++] CurrentSize プロパティの使用例を次に示します。この例のコンテキスト全体については、 IsolatedStorageFile の概要を参照してください。

 
Dim writer As New StreamWriter(isoStream)
' Update the data based on the new inputs.
writer.WriteLine(Me.NewsUrl)
writer.WriteLine(Me.SportsUrl)

'  Calculate the amount of space used to record this user's preferences.
Dim d As Double = Convert.ToDouble(isoFile.CurrentSize) / Convert.ToDouble(isoFile.MaximumSize)
Console.WriteLine(("CurrentSize = " & isoFile.CurrentSize.ToString()))
Console.WriteLine(("MaximumSize = " & isoFile.MaximumSize.ToString()))

[C#] 
StreamWriter writer = new StreamWriter(isoStream);
// Update the data based on the new inputs.
writer.WriteLine(this.NewsUrl);
writer.WriteLine(this.SportsUrl);

// Calculate the amount of space used to record this user's preferences.
double d = isoFile.CurrentSize/isoFile.MaximumSize;
Console.WriteLine("CurrentSize = " + isoFile.CurrentSize.ToString());
Console.WriteLine("MaximumSize = " + isoFile.MaximumSize.ToString());

[C++] 
StreamWriter* writer = new StreamWriter(isoStream);
// Update the data based on the new inputs.
writer->WriteLine(this->NewsUrl);
writer->WriteLine(this->SportsUrl);

// Calculate the amount of space used to record this user's preferences.
double d = isoFile->CurrentSize/isoFile->MaximumSize;
Console::WriteLine(S"CurrentSize = {0}", isoFile->CurrentSize.ToString());
Console::WriteLine(S"MaximumSize = {0}", isoFile->MaximumSize.ToString());

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

IsolatedStorageFile クラス | IsolatedStorageFile メンバ | System.IO.IsolatedStorage 名前空間