Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 CurrentSize Property
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
IsolatedStorageFile..::.CurrentSize Property

Gets the current size of the isolated storage.

This API is not CLS-compliant. 

Namespace:  System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
<CLSCompliantAttribute(False)> _
Public Overrides ReadOnly Property CurrentSize As ULong
Visual Basic (Usage)
Dim instance As IsolatedStorageFile
Dim value As ULong

value = instance.CurrentSize
C#
[CLSCompliantAttribute(false)]
public override ulong CurrentSize { get; }
Visual C++
[CLSCompliantAttribute(false)]
public:
virtual property unsigned long long CurrentSize {
    unsigned long long get () override;
}
JScript
public override function get CurrentSize () : ulong

Property Value

Type: System..::.UInt64
The total number of bytes of storage currently in use within the isolated storage scope.
ExceptionCondition
InvalidOperationException

The property is unavailable. The current store has a roaming scope or is not open.

ObjectDisposedException

The current object size is undefined.

Represents the total usage of all files and directories within the isolated storage scope.

The current size cannot be accurately determined for stores that are participating in a roaming user profile. Because roaming profiles are often cached on multiple client machines and later synchronized with a server, quotas cannot be enforced for such stores and the current size is not reported.

The How to: Anticipate Out of Space Conditions with Isolated Storage example demonstrates the use of the CurrentSize property.

The following code example demonstrates the CurrentSize property. For the complete context of this example, see the IsolatedStorageFile overview.

Visual Basic
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());
Visual C++
StreamWriter^ writer = gcnew 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 = {0}", isoFile->CurrentSize.ToString() );
Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() );

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker