Bagikan melalui


StorageDevice.DeleteContainer Method

Deletes a storage container without opening it. You can do this even if the container is corrupted.

Namespace: Microsoft.Xna.Framework.Storage
Assembly: Microsoft.Xna.Framework.Storage (in microsoft.xna.framework.storage.dll)

Syntax

public void DeleteContainer (
         string titleName
)

Parameters

  • titleName
    Type: String
    The name of the storage container to delete.

Exceptions

Exception type Condition
ArgumentNullException titleName is null.
InvalidOperationException

The container is currently open. A container cannot be deleted if it is open.

Dd940266.note(en-us,XNAGameStudio.41).gifNote
No exception will be thrown if the container does not exist.

Remarks

The string passed to titleName must be the same string used with StorageDevice.BeginOpenContainer.

Usually a storage container is closed with StorageContainer.Dispose so that it can be re-opened with its data intact. Use DeleteContainer only when you want to delete the data permanently or when you determine the storage container has been corrupted.

See the What Is Storage? for more information about using storage containers in your title.

See Also

Reference

StorageDevice Class
StorageDevice Members
Microsoft.Xna.Framework.Storage Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP