Aracılığıyla paylaş


IsolatedStorageFile.GetFileNames Method (String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Enumerates files in isolated storage scope that match a given pattern.

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function GetFileNames ( _
    searchPattern As String _
) As String()
[SecuritySafeCriticalAttribute]
public string[] GetFileNames(
    string searchPattern
)

Parameters

  • searchPattern
    Type: System.String
    A search pattern. Both single-character ("?") and multi-character ("*") wildcards are supported.

Return Value

Type: array<System.String[]
An Array of relative paths of files in the isolated storage scope that match searchPattern. A zero-length array specifies that there are no files that match.

Exceptions

Exception Condition
IsolatedStorageException

The store has been removed.

-or-

Isolated storage is disabled.

ArgumentException

searchPattern is badly formed.

ArgumentNullException

searchPattern is nulla null reference (Nothing in Visual Basic).

DirectoryNotFoundException

Cannot find a part of the searchPattern.

ObjectDisposedException

The store has been disposed.

Remarks

The searchPattern "Project\Data*.txt" will give all ".txt" files beginning with Data in the Project directory of the isolated storage scope. For complete description of search pattern strings, see System.IO.Directory.

For information about how to find directory names, see the GetDirectoryNames method.

Examples

The following example gets an array of file names from a subdirectroy.

Dim searchpath As String = Path.Combine(subdirectory1, "*.*")
Dim filesInSubDirs() As String = store.GetFileNames(searchpath)
string searchpath = Path.Combine(subdirectory1, "*.*");
string[] filesInSubDirs = store.GetFileNames(searchpath);

Version Information

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

Platforms

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