Console.Title プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
本体のタイトル バーに表示するタイトルを取得または設定します。
public:
static property System::String ^ Title { System::String ^ get(); void set(System::String ^ value); };
public static string Title { [System.Runtime.Versioning.SupportedOSPlatform("windows")] get; [System.Runtime.Versioning.UnsupportedOSPlatform("android")] [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] [System.Runtime.Versioning.UnsupportedOSPlatform("ios")] [System.Runtime.Versioning.UnsupportedOSPlatform("tvos")] set; }
public static string Title { [System.Runtime.Versioning.SupportedOSPlatform("windows")] get; [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] set; }
public static string Title { get; set; }
[<get: System.Runtime.Versioning.SupportedOSPlatform("windows")>]
[<set: System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<set: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<set: System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<set: System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Title : string with get, set
[<get: System.Runtime.Versioning.SupportedOSPlatform("windows")>]
[<set: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member Title : string with get, set
static member Title : string with get, set
Public Shared Property Title As String
プロパティ値
本体のタイトル バーに表示される文字列。 タイトル文字列の最大長は 2,4500 文字です。
- 属性
例外
取得操作では、取得したタイトルの文字数が 24,500 文字を超える。
設定操作では、指定されたタイトルが 24500 文字を超える。
セット操作では、指定したタイトルが null。
I/O エラーが発生しました。
取得操作は、Windows 以外のオペレーティング システムで呼び出されます。
例
この例では、 Title プロパティを示します。 この例では、オペレーティング システム ウィンドウの現在のタイトルを表示し、キーを押すのを待ってから、新しいタイトルを表示します。
// This example demonstrates the Console.Title property.
using System;
class Sample
{
public static void Main()
{
Console.WriteLine("The current console title is: \"{0}\"",
Console.Title);
Console.WriteLine(" (Press any key to change the console title.)");
Console.ReadKey(true);
Console.Title = "The title has changed!";
Console.WriteLine("Note that the new console title is \"{0}\"\n" +
" (Press any key to quit.)", Console.Title);
Console.ReadKey(true);
}
}
/*
This example produces the following results:
>myTitle
The current console title is: "Command Prompt - myTitle"
(Press any key to change the console title.)
Note that the new console title is "The title has changed!"
(Press any key to quit.)
*/
// This example demonstrates the Console.Title property.
open System
printfn $"The current console title is: \"{Console.Title}\""
printfn " (Press any key to change the console title.)"
Console.ReadKey true |> ignore
Console.Title <- "The title has changed!"
printfn $"Note that the new console title is \"{Console.Title}\"\n (Press any key to quit.)"
Console.ReadKey true |> ignore
// This example produces the following results:
//
// > myTitle
// The current console title is: "Command Prompt - myTitle"
// (Press any key to change the console title.)
// Note that the new console title is "The title has changed!"
// (Press any key to quit.)
' This example demonstrates the Console.Title property.
Class Sample
Public Shared Sub Main()
Console.WriteLine("The current console title is: ""{0}""", Console.Title)
Console.WriteLine(" (Press any key to change the console title.)")
Console.ReadKey(True)
Console.Title = "The title has changed!"
Console.WriteLine("Note that the new console title is ""{0}""" & vbCrLf & _
" (Press any key to quit.)", Console.Title)
Console.ReadKey(True)
End Sub
End Class
'
'This example produces the following results:
'
'>myTitle
'The current console title is: "Command Prompt - myTitle"
' (Press any key to change the console title.)
'Note that the new console title is "The title has changed!"
' (Press any key to quit.)
'