IsolatedStorageFile.DirectoryExists Method

Determines whether the specified path refers to an existing directory in the isolated store.

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

[SecuritySafeCriticalAttribute]
public bool DirectoryExists(
	string path
)

Parameters

path
Type: System.String
The path to test.

Return Value

Type: System.Boolean
true if path refers to an existing directory in the isolated store and is not null; otherwise, false.

ExceptionCondition
IsolatedStorageException

The isolated store has been removed.

-or-

Isolated storage is disabled.

ObjectDisposedException

The isolated store has been disposed.

The following example deletes a specific directory if it exists. This example is part of a larger example provided for IsolatedStorageFile class.


                // Delete a specific directory.
                string dirDelete = Path.Combine("MyApp1", "SubDir3");
                try
                {
                    if (store.DirectoryExists(dirDelete))
                    {
                        store.DeleteDirectory(dirDelete);
                    }
                }
                catch (IsolatedStorageException ex)
                {
                    sb.AppendLine(ex.Message);
                }



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.

Adiciones de comunidad

AGREGAR
Mostrar: