IsolatedStorageFile.GetDirectoryNames 메서드

정의

격리된 저장소의 루트에 있는 디렉터리를 열거합니다.

오버로드

GetDirectoryNames()

격리된 저장소의 루트에 있는 디렉터리를 열거합니다.

GetDirectoryNames(String)

격리된 스토리지 범위 내의 디렉터리 중 지정된 검색 패턴과 일치하는 디렉터리를 나열합니다.

GetDirectoryNames()

Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs

격리된 저장소의 루트에 있는 디렉터리를 열거합니다.

public:
 cli::array <System::String ^> ^ GetDirectoryNames();
public string[] GetDirectoryNames ();
[System.Runtime.InteropServices.ComVisible(false)]
public string[] GetDirectoryNames ();
member this.GetDirectoryNames : unit -> string[]
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.GetDirectoryNames : unit -> string[]
Public Function GetDirectoryNames () As String()

반환

String[]

격리된 저장소의 루트에 있는 디렉터리의 상대 경로가 들어 있는 배열입니다. 길이가 0인 배열은 루트에 디렉터리가 없음을 나타냅니다.

특성

예외

격리된 저장소가 삭제된 경우

격리된 저장소가 닫혀 있습니다.

격리된 저장소가 제거된 경우

호출자에게 디렉터리를 열거할 수 있는 권한이 없습니다.

하나 이상의 디렉터리가 발견되지 않았습니다.

설명

이 메서드는 검색 패턴에 IsolatedStorageFile.GetDirectoryNames(String) 대해 지정된 "*"이 있는 메서드를 사용하는 것과 같습니다.

추가 정보

적용 대상

GetDirectoryNames(String)

Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs

격리된 스토리지 범위 내의 디렉터리 중 지정된 검색 패턴과 일치하는 디렉터리를 나열합니다.

public:
 cli::array <System::String ^> ^ GetDirectoryNames(System::String ^ searchPattern);
public string[] GetDirectoryNames (string searchPattern);
member this.GetDirectoryNames : string -> string[]
Public Function GetDirectoryNames (searchPattern As String) As String()

매개 변수

searchPattern
String

.검색 패턴입니다. 단일 문자("?") 및 다중 문자("*") 와일드카드를 모두 사용할 수 있습니다.

반환

String[]

격리된 스토리지 범위 내의 디렉터리 중 searchPattern과 일치하는 디렉터리의 상대 경로 배열입니다. 길이가 0인 배열은 일치하는 디렉터리가 없음을 나타냅니다.

예외

searchPattern이(가) null인 경우

격리된 저장소가 닫혀 있습니다.

격리된 저장소가 삭제된 경우

호출자에게 searchPattern에서 확인된 디렉터리를 열거할 수 있는 권한이 없습니다.

searchPattern에서 지정한 디렉터리를 찾을 수 없습니다.

격리된 저장소가 제거된 경우

예제

다음 코드 예제는 GetDirectoryNames 메서드. 이 예제의 전체 컨텍스트는 개요를 참조하세요 IsolatedStorageFile .

array<String^>^dirNames = isoFile->GetDirectoryNames( "*" );
array<String^>^fileNames = isoFile->GetFileNames( "*" );

// List directories currently in this Isolated Storage.
if ( dirNames->Length > 0 )
{
   for ( int i = 0; i < dirNames->Length; ++i )
   {
      Console::WriteLine( "Directory Name: {0}", dirNames[ i ] );

   }
}


// List the files currently in this Isolated Storage.
// The list represents all users who have personal preferences stored for this application.
if ( fileNames->Length > 0 )
{
   for ( int i = 0; i < fileNames->Length; ++i )
   {
      Console::WriteLine( "File Name: {0}", fileNames[ i ] );

   }
}
    String[] dirNames = isoFile.GetDirectoryNames("*");
    String[] fileNames = isoFile.GetFileNames("Archive\\*");

    // Delete all the files currently in the Archive directory.

    if (fileNames.Length > 0)
    {
        for (int i = 0; i < fileNames.Length; ++i)
        {
            // Delete the files.
            isoFile.DeleteFile("Archive\\" + fileNames[i]);
        }
        // Confirm that no files remain.
        fileNames = isoFile.GetFileNames("Archive\\*");
    }

    if (dirNames.Length > 0)
    {
        for (int i = 0; i < dirNames.Length; ++i)
        {
            // Delete the Archive directory.
        }
    }
    dirNames = isoFile.GetDirectoryNames("*");
    isoFile.Remove();
}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}
Dim dirNames As String() = isoFile.GetDirectoryNames("*")
Dim fileNames As String() = isoFile.GetFileNames("*")
Dim name As String

' List directories currently in this Isolated Storage.
If dirNames.Length > 0 Then

    For Each name In dirNames
        Console.WriteLine("Directory Name: " & name)
    Next name
End If

' List the files currently in this Isolated Storage.
' The list represents all users who have personal preferences stored for this application.
If fileNames.Length > 0 Then

    For Each name In fileNames
        Console.WriteLine("File Name: " & name)
    Next name
End If

설명

와일드카드 문자는 의 searchPattern마지막 요소에만 있어야 합니다. instance 경우 "directory1/*etc*"는 유효한 검색 문자열이지만 "*etc*/directory"는 그렇지 않습니다.

searchPattern "Project\Data *"는 격리된 스토리지 범위에서 Data로 시작하는 프로젝트의 모든 하위 디렉터리를 제공합니다. "*"는 searchPattern 루트에 있는 모든 디렉터리를 반환합니다. 검색 문자열 조건에 대한 전체 설명은 클래스를 Directory 참조하세요.

파일 이름을 가져오는 방법에 대한 자세한 내용은 메서드를 참조하세요 GetFileNames .

방법: 격리된 스토리지의 기존 파일 및 디렉터리 찾기 예제는 GetDirectoryNames 메서드의 사용을 보여줍니다.

추가 정보

적용 대상