Gets or sets the encoding the console uses to write output.
Assembly: mscorlib (in mscorlib.dll)
The console uses the output encoding to translate characters written by an application into corresponding console display characters. The default code page that the console uses is determined by the system locale.
Starting with the .NET Framework 4, a property get operation may return a cached value instead of the console's current output encoding. This can occur if the value of theproperty is modified by some means other than an assignment to the property, such as calling the Windows SetConsoleOutputCP function.
Notes to Callers:
Of the Unicode encodings, the Console class supports UTF-8 encoding with the UTF8Encoding class and, starting with the .NET Framework 4.5, it supports UTF-16 encoding with the UnicodeEncoding class. UTF-32 encoding with the UTF32Encoding class is not supported. Attempting to set the output encoding to UTF-32 throws an IOException.
Note that successfully displaying Unicode characters to the console requires the following:
The console must use a TrueType font, such as Lucida Console or Consolas, to display characters.
A font used by the console must define the particular glyph or glyphs to be displayed. The console can take advantage of font linking to display glyphs from linked fonts if the base font does not contain a definition for that glyph.
For more information about support for Unicode encoding by the console, see the "Unicode Support for the Console" section in the Console class.
Available since 2.0