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

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

Path.GetInvalidPathChars メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

パス名に使用できない文字を含む配列取得します

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

Public Shared Function GetInvalidPathChars
 As Char()
Dim returnValue As Char()

returnValue = Path.GetInvalidPathChars
public static char[] GetInvalidPathChars
 ()
public:
static array<wchar_t>^ GetInvalidPathChars ()
public static char[] GetInvalidPathChars
 ()
public static function GetInvalidPathChars
 () : char[]

戻り値
パス名に使用できない文字を含む配列

解説解説
使用例使用例

パス検証する GetInvalidFileNameChars メソッドおよび GetInvalidPathChars メソッドコード例次に示します

Imports System
Imports System.IO



Module PathExample

    Sub Main()
        ' Get a list of invalid path characters.
        Dim invalidPathChars As Char()
 = Path.GetInvalidPathChars()

        Console.WriteLine("The following characters are invalid
 ina path:")

        ' Display each invalid character to the console.
        Dim invalidPChar As Char
        For Each invalidPChar In
 invalidPathChars
            Console.WriteLine(invalidPChar)
        Next invalidPChar

        ' Get a list of invalid file characters.
        Dim invalidFileChars As Char()
 = Path.GetInvalidFileNameChars()

        Console.WriteLine("The following characters are invalid
 ina path:")

        ' Display each invalid character to the console.
        Dim invalidFChar As Char
        For Each invalidFChar In
 invalidFileChars
            Console.WriteLine(invalidFChar)
        Next invalidFChar

        Console.ReadLine()

    End Sub
End Module
' Note that while this code attempts to display a list of all invalid
' characters in paths and filenames, not all of the characters are
' within the displayable set of characters. Because the list of invalid
' characters can vary, based on the system, output for this code can
 vary.
using System;
using System.IO;

namespace PathExample
{
    class GetCharExample
    {
        public static void
 Main()
        {
            // Get a list of invalid path characters.
            char[] invalidPathChars = Path.GetInvalidPathChars();

            Console.WriteLine("The following characters are invalid in
 a path:");

            // Display each invalid character to the console.
            foreach (char invalidPChar in
 invalidPathChars)
            {
                Console.WriteLine(invalidPChar);
            }

            // Get a list of invalid file characters.
            char[] invalidFileChars = Path.GetInvalidFileNameChars();

            Console.WriteLine("The following characters are invalid in
 a filename:");

            // Display each invalid character to the console.
            foreach (char invalidFChar in
 invalidFileChars)
            {
                Console.WriteLine(invalidFChar);
            }

            Console.ReadLine();
        }

    }
}
// Note that while this code attempts to display a list of all invalid
// characters in paths and filenames, not all of the characters are
// within the displayable set of characters. Because the list of invalid
// characters can vary, based on the system, output for this code can
 vary.

using namespace System;
using namespace System::IO;

int main()
{
    // Get a list of invalid path characters.
    array<Char>^ invalidPathChars = Path::GetInvalidPathChars();

    Console::WriteLine("The following characters are invalid in
 a path:");

    // Display each invalid character to the console.
    for each (Char invalidPathChar in invalidPathChars)
    {
        Console::WriteLine(invalidPathChar);
    }

    // Get a list of invalid file characters.
    array<Char>^ invalidFileChars = Path::GetInvalidFileNameChars();

    Console::WriteLine("The following characters are invalid in
 a file name:");

    // Display each invalid character to the console.
    for each (Char invalidFileChar in invalidFileChars)
    {
        Console::WriteLine(invalidFileChar);
    }

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からPath.GetInvalidPathChars メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からPath.GetInvalidPathChars メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からPath.GetInvalidPathChars メソッド を検索

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

辞書ショートカット

すべての辞書の索引

「Path.GetInvalidPathChars メソッド」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS