IsolatedStorageFile.GetFileNames 메서드

정의

격리된 저장소의 루트에 있는 파일 이름을 열거합니다.

오버로드

Name Description
GetFileNames()

격리된 저장소의 루트에 있는 파일 이름을 열거합니다.

GetFileNames(String)

검색 패턴과 일치하는 파일 이름을 가져옵니다.

GetFileNames()

격리된 저장소의 루트에 있는 파일 이름을 열거합니다.

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

반품

String[]

격리된 저장소의 루트에 있는 파일의 상대 경로 배열입니다. 길이가 0인 배열은 루트에 파일이 없음을 지정합니다.

특성

예외

격리된 저장소가 제거되었습니다.

격리된 저장소가 삭제되었습니다.

격리된 저장소 루트의 파일 경로를 확인할 수 없습니다.

설명

이 메서드는 검색 패턴에 IsolatedStorageFile.GetFileNames(String) 지정된 "*"와 함께 메서드를 사용하는 것과 같습니다.

추가 정보

적용 대상

GetFileNames(String)

검색 패턴과 일치하는 파일 이름을 가져옵니다.

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

매개 변수

searchPattern
String

검색 패턴입니다. 단일 문자("?") 및 다중 문자("*") 와일드카드가 모두 지원됩니다.

반품

String[]

일치하는 searchPattern격리된 스토리지 범위에 있는 파일의 상대 경로 배열입니다. 길이가 0인 배열은 일치하는 파일이 없음을 지정합니다.

예외

searchPatternnull입니다.

격리된 저장소가 삭제되었습니다.

격리된 저장소가 제거되었습니다.

지정한 searchPattern 파일 경로를 찾을 수 없습니다.

예제

다음 코드 예제에서는 메서드를 GetFileNames 보여 줍니다. 이 예제의 전체 컨텍스트는 개요를 참조하세요 IsolatedStorageFile .

    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 "Project\Data*.txt"은 격리된 스토리지 범위의 Project 디렉터리에 있는 데이터로 시작하는 모든 ".txt" 파일을 제공합니다. 검색 패턴 문자열에 대한 전체 설명은 다음을 참조하세요 System.IO.Directory.

디렉터리 이름을 찾는 방법에 대한 자세한 내용은 메서드를 참조하세요 GetDirectoryNames .

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

추가 정보

적용 대상