IsolatedStorageFile.GetFileNames メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IsolatedStorageFile.GetFileNames メソッドの意味・解説 

IsolatedStorageFile.GetFileNames メソッド

分離ストレージスコープ内にあり、指定したパターン一致するファイル列挙します

名前空間: System.IO.IsolatedStorage
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function GetFileNames ( _
    searchPattern As String _
) As String()
Dim instance As IsolatedStorageFile
Dim searchPattern As String
Dim returnValue As String()

returnValue = instance.GetFileNames(searchPattern)
public string[] GetFileNames (
    string searchPattern
)
public:
array<String^>^ GetFileNames (
    String^ searchPattern
)
public String[] GetFileNames (
    String searchPattern
)
public function GetFileNames (
    searchPattern : String
) : String[]

パラメータ

searchPattern

検索パターン単一文字を表すワイルドカード ("?") と複数文字を表すワイルドカード ("*") の両方サポートされています。

戻り値
分離ストレージスコープ内にあり、searchPattern一致するファイル相対パスArray長さ 0 の配列返され場合は、一致するファイル存在しません。

例外例外
例外種類条件

ArgumentNullException

searchPatternnull 参照 (Visual Basic では Nothing) でした。

解説解説

searchPattern を "Project\Data*.txt" にすると、分離ストレージスコープ内にある Project ディレクトリData から始まる ".txt" ファイルがすべて返されます。検索パターン文字列詳細については、System.IO.Directory のトピック参照してください

ディレクトリ名の検索方法については、GetDirectoryNames メソッドトピック参照してください

GetFileNames メソッド使用方法については、「既存ファイルおよびディレクトリ検索」の例を参照してください

使用例使用例

GetFileNames メソッドコード例次に示します。この例のコンテキスト全体については、IsolatedStorageFile の概要参照してください

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

   }
}


.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IsolatedStorageFile クラス
IsolatedStorageFile メンバ
System.IO.IsolatedStorage 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

IsolatedStorageFile.GetFileNames メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IsolatedStorageFile.GetFileNames メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS