HttpWebResponse.CharacterSet プロパティ    
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
応答の文字セットを取得します。
public:
 property System::String ^ CharacterSet { System::String ^ get(); };
	public string? CharacterSet { get; }
	public string CharacterSet { get; }
	member this.CharacterSet : string
	Public ReadOnly Property CharacterSet As String
	プロパティ値
応答の文字セットを含む文字列。
例外
現在のインスタンスは破棄されています。
例
次の例では、応答の文字セットを取得します。
try
      {	
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
        HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
        Console.WriteLine("The encoding method used is: " + myHttpWebResponse.ContentEncoding);
        Console.WriteLine("The character set used is :" + myHttpWebResponse.CharacterSet);
        char seperator = '/';
        String contenttype = myHttpWebResponse.ContentType;
        // Retrieve 'text' if the content type is of 'text/html.
        String maintype = contenttype.Substring(0,contenttype.IndexOf(seperator));
        // Display only 'text' type.
        if (String.Compare(maintype,"text") == 0)
            {
            Console.WriteLine("\n Content type is 'text'.");
Try
   Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
   Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
   
   Console.WriteLine(("The encoding method used is: " + myHttpWebResponse.ContentEncoding))
   Console.WriteLine(("The character set used is :" + myHttpWebResponse.CharacterSet))
   
   Dim seperator As Char = "/"c
   Dim contenttype As [String] = myHttpWebResponse.ContentType
   ' Retrieve 'text' if the content type is of 'text/html.
   Dim maintype As [String] = contenttype.Substring(0, contenttype.IndexOf(seperator))
   ' Display only 'text' type.
   If [String].Compare(maintype, "text") = 0 Then
      Console.WriteLine(ControlChars.NewLine + " Content type is 'text'.")
	注釈
プロパティには CharacterSet 、応答の文字セットを記述する値が含まれています。 この文字セット情報は、応答で返されるヘッダーから取得されます。