DirectoryExists Method

IsolatedStorageFile.DirectoryExists Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

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);
                }



Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft