Export (0) Print
Expand All

IsolatedStorageFile.Quota Property

Gets a value that represents the maximum amount of space available for isolated storage.

Namespace:  System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)

public long Quota { get; }

Property Value

Type: System.Int64
The limit of isolated storage space, in bytes.

ExceptionCondition
IsolatedStorageException

The isolated store has been removed.

-or-

Isolated storage is disabled.

ObjectDisposedException

The isolated store has been disposed.

This property obtains the value from the store's associated quota group. The initial quota is 1 MB to be shared by all of the domain's applications.

Use the AvailableFreeSpace property to determine whether you need to increase the quota by using the IncreaseQuotaTo method.

The following example checks the quota size. This example is part of a larger example provided for IsolatedStorageFile class.


// Assumes an event handler for the MouseLeftbuttonUp
// event is defined for a control named 'IncreaseQuota'
// In the control's XAML: MouseLeftButtonUp="IncreaseQuota_OnLeftMouseButtonUp"

// User first selects UI to increase the quota.
public void IncreaseQuota_OnClick(object sender, MouseEventArgs e)
{

    // Obtain an isolated store for an application.
    try
    {
        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
        {
            // Request 5MB more space in bytes.
            Int64 spaceToAdd = 5242880;
            Int64 curAvail = store.AvailableFreeSpace;

            // If available space is less than
            // what is requested, try to increase.
            if (curAvail < spaceToAdd)
            {

                // Request more quota space.
                if (!store.IncreaseQuotaTo(store.Quota + spaceToAdd))
                {
                    // The user clicked NO to the
                    // host's prompt to approve the quota increase.
                }
                else
                {
                    // The user clicked YES to the
                    // host's prompt to approve the quota increase.
                }
            }
        }
    }

    catch (IsolatedStorageException)
    {
        // TODO: Handle that store could not be accessed.

    }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft