Console.InputEncoding Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the encoding the console uses to read input.
public:
static property System::Text::Encoding ^ InputEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.Text.Encoding InputEncoding { get; set; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Text.Encoding InputEncoding { get; set; }
public static System.Text.Encoding InputEncoding { get; set; }
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member InputEncoding : System.Text.Encoding with get, set
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member InputEncoding : System.Text.Encoding with get, set
static member InputEncoding : System.Text.Encoding with get, set
Public Shared Property InputEncoding As Encoding
The encoding used to read console input.
- Attributes
The property value in a set operation is null
.
An error occurred during the execution of this operation.
Your application does not have permission to perform this operation.
The console uses the input encoding to translate keyboard input into a corresponding character. The input encoding incorporates a code page that maps 256 keyboard character codes to individual characters. Different code pages include different special characters, typically customized for a language or a group of languages.
Starting with the .NET Framework 4, a property get operation may return a cached value instead of the console's current input encoding. This can occur if the value of the InputEncoding property is modified by some means other than an assignment to the InputEncoding property, such as calling the Windows SetConsoleCP
function or using the chcp
command from a PowerShell script.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.3, 1.4, 1.6, 2.0, 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: