Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
6034 lines (5282 sloc) 408 KB
<Type Name="Console" FullName="System.Console">
<TypeSignature Language="C#" Value="public static class Console" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed Console extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.Console" />
<TypeSignature Language="VB.NET" Value="Public Class Console" />
<TypeSignature Language="C++ CLI" Value="public ref class Console abstract sealed" />
<TypeSignature Language="F#" Value="type Console = class" />
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The console is an operating system window where users interact with the operating system or with a text-based console application by entering text input through the computer keyboard, and by reading text output from the computer terminal. For example, in the Windows operating system, the console is called the Command Prompt window and accepts MS-DOS commands. The <xref:System.Console> class provides basic support for applications that read characters from, and write characters to, the console.
For information about developing with the <xref:System.Console> class, see the following sections:
- [Console I/O Streams](#Streams)
- [Screen Buffer and Console Window](#Buffer)
- [Unicode Support for the Console](#Unicode)
- [Common Operations](#Operations)
- [.NET Core Notes](#Core)
<a name="Streams"></a>
## Console I/O Streams
When a console application starts, the operating system automatically associates three I/O streams with the console: standard input stream, standard output stream, and standard error output stream. Your application can read user input from the standard input stream; write normal data to the standard output stream; and write error data to the standard error output stream. These streams are presented to your application as the values of the <xref:System.Console.In%2A?displayProperty=nameWithType>, <xref:System.Console.Out%2A?displayProperty=nameWithType>, and <xref:System.Console.Error%2A?displayProperty=nameWithType> properties.
By default, the value of the <xref:System.Console.In%2A> property is a <xref:System.IO.TextReader?displayProperty=nameWithType> object that represents the keyboard, and the values of the <xref:System.Console.Out%2A> and <xref:System.Console.Error%2A> properties are <xref:System.IO.TextWriter?displayProperty=nameWithType> objects that represent a console window. However, you can set these properties to streams that do not represent the console window or keyboard; for example, you can set these properties to streams that represent files. To redirect the standard input, standard output, or standard error stream, call the <xref:System.Console.SetIn%2A?displayProperty=nameWithType>, <xref:System.Console.SetOut%2A?displayProperty=nameWithType>, or <xref:System.Console.SetError%2A?displayProperty=nameWithType> method, respectively. I/O operations that use these streams are synchronized, which means that multiple threads can read from, or write to, the streams. This means that methods that are ordinarily asynchronous, such as <xref:System.IO.TextReader.ReadLineAsync%2A?displayProperty=nameWithType>, execute synchronously if the object represents a console stream.
> [!NOTE]
> Do not use the <xref:System.Console> class to display output in unattended applications, such as server applications. Calls to methods such as <xref:System.Console.Write%2A?displayProperty=nameWithType> and <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> have no effect in GUI applications.
<xref:System.Console> class members that work normally when the underlying stream is directed to a console might throw an exception if the stream is redirected, for example, to a file. Program your application to catch <xref:System.IO.IOException?displayProperty=nameWithType> exceptions if you redirect a standard stream. You can also use the <xref:System.Console.IsOutputRedirected%2A>, <xref:System.Console.IsInputRedirected%2A>, and <xref:System.Console.IsErrorRedirected%2A> properties to determine whether a standard stream is redirected before performing an operation that throws an <xref:System.IO.IOException?displayProperty=nameWithType> exception.
It is sometimes useful to explicitly call the members of the stream objects represented by the <xref:System.Console.In%2A>, <xref:System.Console.Out%2A>, and <xref:System.Console.Error%2A> properties. For example, by default, the <xref:System.Console.ReadLine%2A?displayProperty=nameWithType> method reads input from the standard input stream. Similarly, the <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> method writes data to the standard output stream, and the data is followed by the default line termination string, which is a carriage return and line feed ("\r\n"). However, the <xref:System.Console> class does not provide a corresponding method to write data to the standard error output stream, or a property to change the line termination string for data written to that stream.
You can solve this problem by setting the <xref:System.IO.TextWriter.NewLine%2A?displayProperty=nameWithType> property of the <xref:System.Console.Out%2A> or <xref:System.Console.Error%2A> property to another line termination string. For example, the following C# statement sets the line termination string for the standard error output stream to two carriage return and line feed sequences:
`Console.Error.NewLine = "\r\n\r\n";`
You can then explicitly call the <xref:System.IO.TextWriter.WriteLine%2A> method of the error output stream object, as in the following C# statement:
`Console.Error.WriteLine();`
<a name="Buffer"></a>
## Screen Buffer and Console Window
Two closely related features of the console are the screen buffer and the console window. Text is actually read from or written to streams owned by the console, but appear to be read from or written to an area owned by the console called the screen buffer. The screen buffer is an attribute of the console, and is organized as a rectangular grid of rows and columns where each grid intersection, or character cell, can contain a character. Each character has its own foreground color, and each character cell has its own background color.
The screen buffer is viewed through a rectangular region called the console window. The console window is another attribute of the console; it is not the console itself, which is an operating system window. The console window is arranged in rows and columns, is less than or equal to the size of the screen buffer, and can be moved to view different areas of the underlying screen buffer. If the screen buffer is larger than the console window, the console automatically displays scroll bars so the console window can be repositioned over the screen buffer area.
A cursor indicates the screen buffer position where text is currently read or written. The cursor can be hidden or made visible, and its height can be changed. If the cursor is visible, the console window position is moved automatically so the cursor is always in view.
The origin for character cell coordinates in the screen buffer is the upper left corner, and the positions of the cursor and the console window are measured relative to that origin. Use zero-based indexes to specify positions; that is, specify the topmost row as row 0, and the leftmost column as column 0. The maximum value for the row and column indexes is <xref:System.Int16.MaxValue?displayProperty=nameWithType>.
<a name="Unicode"></a>
## Unicode Support for the Console
In general, the console reads input and writes output by using the current console code page, which the system locale defines by default. A code page can handle only a subset of available Unicode characters, so if you try to display characters that are not mapped by a particular code page, the console won't be able to display all characters or represent them accurately. The following example illustrates this problem. It tries to display the characters of the Cyrillic alphabet from U+0410 to U+044F to the console. If you run the example on a system that uses console code page 437, each character is replaced by a question mark (?), because Cyrillic characters do not map to the characters in code page 437.
[!code-csharp[System.Console.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/unicode1.cs#1)]
[!code-vb[System.Console.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/unicode1.vb#1)]
In addition to supporting code pages, the <xref:System.Console> class supports UTF-8 encoding with the <xref:System.Text.UTF8Encoding> class. Beginning with the .NET Framework 4.5, the <xref:System.Console> class also supports UTF-16 encoding with the <xref:System.Text.UnicodeEncoding> class. To display Unicode characters to the console. you set the <xref:System.Console.OutputEncoding%2A> property to either <xref:System.Text.UTF8Encoding> or <xref:System.Text.UnicodeEncoding>.
Support for Unicode characters requires the encoder to recognize a particular Unicode character, and also requires a font that has the glyphs needed to render that character. To successfully display Unicode characters to the console, the console font must be set to a non-raster or TrueType font such as Consolas or Lucida Console. The following example shows how you can programmatically change the font from a raster font to Lucida Console.
[!code-csharp[System.Console.Class.Unsafe#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class.unsafe/cs/setfont1.cs#3)]
[!code-vb[System.Console.Class.Unsafe#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class.unsafe/vb/setfont1.vb#3)]
However, TrueType fonts can display only a subset of glyphs. For example, the Lucida Console font displays only 643 of the approximately 64,000 available characters from U+0021 to U+FB02. To see which characters a particular font supports, open the **Fonts** applet in Control Panel, choose the **Find a character** option, and choose the font whose character set you'd like to examine in the **Font** list of the **Character Map** window.
Windows uses font linking to display glyphs that are not available in a particular font. For information about font linking to display additional character sets, see [Globalization Step-by-Step: Fonts](https://go.microsoft.com/fwlink/?LinkId=229111). Linked fonts are defined in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink subkey of the registry. Each entry associated with this subkey corresponds to the name of a base font, and its value is a string array that defines the font files and the fonts that are linked to the base font. Each member of the array defines a linked font and takes the form *font-file-name*,*font-name*. The following example illustrates how you can programmatically define a linked font named SimSun found in a font file named simsun.ttc that displays Simplified Han characters.
[!code-csharp[System.Console.Class#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/fontlink1.cs#2)]
[!code-vb[System.Console.Class#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/fontlink1.vb#2)]
Unicode support for the console has the following limitations:
- UTF-32 encoding is not supported. The only supported Unicode encodings are UTF-8 and UTF-16, which are represented by the <xref:System.Text.UTF8Encoding> and <xref:System.Text.UnicodeEncoding> classes, respectively.
- Bidirectional output is not supported.
- Display of characters outside the Basic Multilingual Plane (that is, of surrogate pairs) is not supported, even if they are defined in a linked font file.
- Display of characters in complex scripts is not supported.
- Combining character sequences (that is, characters that consist of a base character and one or more combining characters) are displayed as separate characters. To work around this limitation, you can normalize the string to be displayed by calling the <xref:System.String.Normalize%2A?displayProperty=nameWithType> method before sending output to the console. In the following example, a string that contains the combining character sequence U+0061 U+0308 is displayed to the console as two characters before the output string is normalized, and as a single character after the <xref:System.String.Normalize%2A?displayProperty=nameWithType> method is called.
[!code-csharp[System.Console.Class#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/normalize1.cs#5)]
[!code-vb[System.Console.Class#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/normalize1.vb#5)]
Note that normalization is a viable solution only if the Unicode standard for the character includes a pre-composed form that corresponds to a particular combining character sequence.
- If a font provides a glyph for a code point in the private use area, that glyph will be displayed. However, because characters in the private use area are application-specific, this may not be the expected glyph.
The following example displays a range of Unicode characters to the console. The example accepts three command-line parameters: the start of the range to display, the end of the range to display, and whether to use the current console encoding (`false`) or UTF-16 encoding (`true`). It assumes that the console is using a TrueType font.
[!code-csharp[System.Console.Class#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/example3.cs#4)]
[!code-vb[System.Console.Class#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/example3.vb#4)]
<a name="Operations"></a>
## Common Operations
The <xref:System.Console> class contains the following methods for reading console input and writing console output:
- The overloads of the <xref:System.Console.ReadKey%2A> method read an individual character.
- The <xref:System.Console.ReadLine%2A> method reads an entire line of input.
- The <xref:System.Console.Write%2A> method overloads convert an instance of a value type, an array of characters, or a set of objects to a formatted or unformatted string, and then write that string to the console.
- A parallel set of <xref:System.Console.WriteLine%2A> method overloads output the same string as the <xref:System.Console.Write%2A> overloads but also add a line termination string.
The <xref:System.Console> class also contains methods and properties to perform the following operations:
- Get or set the size of the screen buffer. The <xref:System.Console.BufferHeight%2A> and <xref:System.Console.BufferWidth%2A> properties let you get or set the buffer height and width, respectively, and the <xref:System.Console.SetBufferSize%2A> method lets you set the buffer size in a single method call.
- Get or set the size of the console window. The <xref:System.Console.WindowHeight%2A> and <xref:System.Console.WindowWidth%2A> properties let you get or set the window height and width, respectively, and the <xref:System.Console.SetWindowSize%2A> method lets you set the window size in a single method call.
- Get or set the size of the cursor. The <xref:System.Console.CursorSize%2A> property specifies the height of the cursor in a character cell.
- Get or set the position of the console window relative to the screen buffer. The <xref:System.Console.WindowTop%2A> and <xref:System.Console.WindowLeft%2A> properties let you get or set the top row and leftmost column of the screen buffer that appears in the console window, and the <xref:System.Console.SetWindowPosition%2A> method lets you set these values in a single method call.
- Get or set the position of the cursor by getting or setting the <xref:System.Console.CursorTop%2A> and <xref:System.Console.CursorLeft%2A> properties, or set the position of the cursor by calling the <xref:System.Console.SetCursorPosition%2A> method.
- Move or clear data in the screen buffer by calling the <xref:System.Console.MoveBufferArea%2A> or <xref:System.Console.Clear%2A> method.
- Get or set the foreground and background colors by using the <xref:System.Console.ForegroundColor%2A> and <xref:System.Console.BackgroundColor%2A> properties, or reset the background and foreground to their default colors by calling the <xref:System.Console.ResetColor%2A> method.
- Play the sound of a beep through the console speaker by calling the <xref:System.Console.Beep%2A> method.
<a name="Core"></a>
## [!INCLUDE[net_core](~/includes/net-core-md.md)] Notes
In the .NET Framework on the desktop, the <xref:System.Console> class uses the encoding returned by `GetConsoleCP` and `GetConsoleOutputCP`, which typically is a code page encoding. For example code, on systems whose culture is English (United States), code page 437 is the encoding that is used by default. However, [!INCLUDE[net_core](~/includes/net-core-md.md)] may make only a limited subset of these encodings available. Where this is the case, <xref:System.Text.Encoding.UTF8%2A?displayProperty=nameWithType> is used as the default encoding for the console.
If your app depends on specific code page encodings, you can still make them available by doing the following *before* you call any <xref:System.Console> methods:
1. Add a reference to the System.Text.Encoding.CodePages.dll assembly to your project.
2. Retrieve the <xref:System.Text.EncodingProvider> object from the <xref:System.Text.CodePagesEncodingProvider.Instance%2A?displayProperty=nameWithType> property.
3. Pass the <xref:System.Text.EncodingProvider> object to the <xref:System.Text.Encoding.RegisterProvider%2A?displayProperty=nameWithType> method to make the additional encodings supported by the encoding provider available.
The <xref:System.Console> class will then automatically use the default system encoding rather than UTF8, provided that you have registered the encoding provider before calling any <xref:System.Console> output methods.
## Examples
The following example demonstrates how to read data from, and write data to, the standard input and output streams. Note that these streams can be redirected by using the <xref:System.Console.SetIn%2A> and <xref:System.Console.SetOut%2A> methods.
[!code-cpp[Classic Console Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Console Example/CPP/source.cpp#1)]
[!code-csharp[Classic Console Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Console Example/CS/source.cs#1)]
[!code-vb[Classic Console Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Console Example/VB/source.vb#1)]
]]></format>
</remarks>
<threadsafe>This type is thread safe.</threadsafe>
</Docs>
<Members>
<Member MemberName="BackgroundColor">
<MemberSignature Language="C#" Value="public static ConsoleColor BackgroundColor { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property valuetype System.ConsoleColor BackgroundColor" />
<MemberSignature Language="DocId" Value="P:System.Console.BackgroundColor" />
<MemberSignature Language="VB.NET" Value="Public Shared Property BackgroundColor As ConsoleColor" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property ConsoleColor BackgroundColor { ConsoleColor get(); void set(ConsoleColor value); };" />
<MemberSignature Language="F#" Value="member this.BackgroundColor : ConsoleColor with get, set" Usage="System.Console.BackgroundColor" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.ConsoleColor</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the background color of the console.</summary>
<value>A value that specifies the background color of the console; that is, the color that appears behind each character. The default is black.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A change to the <xref:System.Console.BackgroundColor%2A> property affects only output that is written to individual character cells after the background color is changed. To change the background color of the console window as a whole, set the <xref:System.Console.BackgroundColor%2A> property and call the <xref:System.Console.Clear%2A> method. The following example provides an illustration.
[!code-csharp[System.Console.BackgroundColor#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.backgroundcolor/cs/backgroundcolor1.cs#1)]
[!code-vb[System.Console.BackgroundColor#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.backgroundcolor/vb/backgroundcolor1.vb#1)]
A get operation for a Windows-based application, in which a console does not exist, returns <xref:System.ConsoleColor.Black?displayProperty=nameWithType>.
## Examples
The following example saves the values of the <xref:System.ConsoleColor> enumeration to an array and stores the current values of the <xref:System.Console.BackgroundColor%2A> and <xref:System.Console.ForegroundColor%2A> properties to variables. It then changes the foreground color to each color in the <xref:System.ConsoleColor> enumeration except to the color that matches the current background, and it changes the background color to each color in the <xref:System.ConsoleColor> enumeration except to the color that matches the current foreground. (If the foreground color is the same as the background color, the text isn't visible.) Finally, it calls the <xref:System.Console.ResetColor%2A> method to restore the original console colors.
[!code-csharp[System.ConsoleColor#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.consolecolor/cs/foregroundcolor3.cs#1)]
[!code-vb[System.ConsoleColor#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.consolecolor/vb/foregroundcolor3.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The color specified in a set operation is not a valid member of <see cref="T:System.ConsoleColor" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<MemberGroup MemberName="Beep">
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Plays the sound of a beep through the console speaker.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Beep">
<MemberSignature Language="C#" Value="public static void Beep ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Beep() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.Beep" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Beep ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Beep();" />
<MemberSignature Language="F#" Value="static member Beep : unit -&gt; unit" Usage="System.Console.Beep " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Plays the sound of a beep through the console speaker.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the beep plays at a frequency of 800 hertz for a duration of 200 milliseconds.
> [!NOTE]
> The <xref:System.Console.Beep%2A> method is not supported on the 64-bit editions of Windows Vista and Windows XP.
<xref:System.Console.Beep%2A> wraps a call to the Windows [Beep function](https://msdn.microsoft.com/library/windows/desktop/ms679277.aspx). Whether <xref:System.Console.Beep%2A> produces a sound on versions of Windows before Windows 7 depends on the presence of a 8254 programmable interval timer chip. Starting with Windows 7, it depends on the default sound device.
## Examples
The following example demonstrates the <xref:System.Console.Beep%2A> method. The example accepts a number from 1 through 9 as a command line argument, and plays the beep that number of times.
[!code-cpp[console.beep#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp#1)]
[!code-csharp[console.beep#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.beep/CS/beep.cs#1)]
[!code-vb[console.beep#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.beep/VB/beep.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.Security.HostProtectionException">This method was executed on a server, such as SQL Server, that does not permit access to a user interface.</exception>
</Docs>
</Member>
<Member MemberName="Beep">
<MemberSignature Language="C#" Value="public static void Beep (int frequency, int duration);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Beep(int32 frequency, int32 duration) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.Beep(System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Beep (frequency As Integer, duration As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Beep(int frequency, int duration);" />
<MemberSignature Language="F#" Value="static member Beep : int * int -&gt; unit" Usage="System.Console.Beep (frequency, duration)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="frequency" Type="System.Int32" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="duration" Type="System.Int32" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="frequency">The frequency of the beep, ranging from 37 to 32767 hertz.</param>
<param name="duration">The duration of the beep measured in milliseconds.</param>
<summary>Plays the sound of a beep of a specified frequency and duration through the console speaker.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Console.Beep%2A> wraps a call to the Windows [Beep function](https://msdn.microsoft.com/library/windows/desktop/ms679277.aspx). Whether <xref:System.Console.Beep%2A> produces a sound on versions of Windows before Windows 7 depends on the presence of a 8254 programmable interval timer chip. Starting with Windows 7, it depends on the default sound device.
> [!NOTE]
> The <xref:System.Console.Beep%2A> method is not supported on the 64-bit editions of Windows Vista and Windows XP.
## Examples
This example demonstrates the <xref:System.Console.Beep%2A> method by playing the first few notes of a song through the console speaker.
[!code-cpp[console.beep2#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp#1)]
[!code-csharp[console.beep2#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.beep2/CS/b2.cs#1)]
[!code-vb[console.beep2#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.beep2/VB/b2.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="frequency" /> is less than 37 or more than 32767 hertz.
-or-
<paramref name="duration" /> is less than or equal to zero.</exception>
<exception cref="T:System.Security.HostProtectionException">This method was executed on a server, such as SQL Server, that does not permit access to the console.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows.</exception>
</Docs>
</Member>
<Member MemberName="BufferHeight">
<MemberSignature Language="C#" Value="public static int BufferHeight { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property int32 BufferHeight" />
<MemberSignature Language="DocId" Value="P:System.Console.BufferHeight" />
<MemberSignature Language="VB.NET" Value="Public Shared Property BufferHeight As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int BufferHeight { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.BufferHeight : int with get, set" Usage="System.Console.BufferHeight" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the height of the buffer area.</summary>
<value>The current height, in rows, of the buffer area.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property defines the number of rows (or lines) stored in the buffer that is accessed by a console mode window. In contrast, the <xref:System.Console.WindowHeight%2A> property defines the number of rows that are actually displayed in the console window at any particular time. If the number of rows actually written to the buffer exceeds the number of rows defined by the <xref:System.Console.WindowHeight%2A> property, the window can be scrolled vertically so that it displays a contiguous number of rows that are equal to the <xref:System.Console.WindowHeight%2A> property and are located anywhere in the buffer.
If a set operation decreases the value of the <xref:System.Console.BufferHeight%2A> property, the uppermost lines are removed. For example, if the number of lines is reduced from 300 to 250, lines 0 through 49 are removed, and the existing lines 50 through 299 become lines 0 through 249.
## Examples
This example demonstrates the <xref:System.Console.BufferHeight%2A> and <xref:System.Console.BufferWidth%2A> properties. The example reports the dimensions of an operating system window set to a buffer size of 300 rows and 85 columns.
[!code-cpp[console.bufferHW#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp#1)]
[!code-csharp[console.bufferHW#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.bufferHW/CS/hw.cs#1)]
[!code-vb[console.bufferHW#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.bufferHW/VB/hw.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The value in a set operation is less than or equal to zero.
-or-
The value in a set operation is greater than or equal to <see cref="F:System.Int16.MaxValue" />.
-or-
The value in a set operation is less than <see cref="P:System.Console.WindowTop" /> + <see cref="P:System.Console.WindowHeight" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.PlatformNotSupportedException">The set operation is invoked on an operating system other than Windows.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="BufferWidth">
<MemberSignature Language="C#" Value="public static int BufferWidth { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property int32 BufferWidth" />
<MemberSignature Language="DocId" Value="P:System.Console.BufferWidth" />
<MemberSignature Language="VB.NET" Value="Public Shared Property BufferWidth As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int BufferWidth { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.BufferWidth : int with get, set" Usage="System.Console.BufferWidth" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the width of the buffer area.</summary>
<value>The current width, in columns, of the buffer area.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If a set operation decreases the value of the <xref:System.Console.BufferWidth%2A> property, the rightmost columns are removed. For example, if the number of columns is reduced from 80 to 60, columns 60 through 79 of each row are removed.
## Examples
This example demonstrates the <xref:System.Console.BufferHeight%2A> and <xref:System.Console.BufferWidth%2A> properties. The example reports the dimensions of an operating system window set to a buffer size of 300 rows and 85 columns.
[!code-cpp[console.bufferHW#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp#1)]
[!code-csharp[console.bufferHW#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.bufferHW/CS/hw.cs#1)]
[!code-vb[console.bufferHW#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.bufferHW/VB/hw.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The value in a set operation is less than or equal to zero.
-or-
The value in a set operation is greater than or equal to <see cref="F:System.Int16.MaxValue" />.
-or-
The value in a set operation is less than <see cref="P:System.Console.WindowLeft" /> + <see cref="P:System.Console.WindowWidth" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.PlatformNotSupportedException">The set operation is invoked on an operating system other than Windows.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="CancelKeyPress">
<MemberSignature Language="C#" Value="public static event ConsoleCancelEventHandler CancelKeyPress;" />
<MemberSignature Language="ILAsm" Value=".event class System.ConsoleCancelEventHandler CancelKeyPress" />
<MemberSignature Language="DocId" Value="E:System.Console.CancelKeyPress" />
<MemberSignature Language="VB.NET" Value="Public Shared Custom Event CancelKeyPress As ConsoleCancelEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static event ConsoleCancelEventHandler ^ CancelKeyPress;" />
<MemberSignature Language="F#" Value="member this.CancelKeyPress : ConsoleCancelEventHandler " Usage="member this.CancelKeyPress : System.ConsoleCancelEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>add: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>remove: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.ConsoleCancelEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the <see cref="F:System.ConsoleModifiers.Control" /> modifier key (Ctrl) and either the <see cref="F:System.ConsoleKey.C" /> console key (C) or the Break key are pressed simultaneously (Ctrl+C or Ctrl+Break).</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This event is used in conjunction with <xref:System.ConsoleCancelEventHandler?displayProperty=nameWithType> and <xref:System.ConsoleCancelEventArgs?displayProperty=nameWithType>. The <xref:System.Console.CancelKeyPress> event enables a console application to intercept the Ctrl+C signal so the event handler can decide whether to continue executing or terminate. For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
When the user presses either Ctrl+C or Ctrl+Break, the <xref:System.Console.CancelKeyPress> event is fired and the application's <xref:System.ConsoleCancelEventHandler> event handler is executed. The event handler is passed a <xref:System.ConsoleCancelEventArgs> object that has two useful properties:
- <xref:System.ConsoleCancelEventArgs.SpecialKey%2A>, which allows you to determine whether the handler was invoked as a result of the user pressing Ctrl+C (the property value is <xref:System.ConsoleSpecialKey.ControlC?displayProperty=nameWithType>) or Ctrl+Break (the property value is <xref:System.ConsoleSpecialKey.ControlBreak?displayProperty=nameWithType>).
- <xref:System.ConsoleCancelEventArgs.Cancel%2A>, which allows you to determine how to your application should respond to the user pressing Ctrl+C or Ctrl+Break. By default, the <xref:System.ConsoleCancelEventArgs.Cancel%2A> property is `false`, which causes program execution to terminate when the event handler exits. Changing its property to `true` specifies that the application should continue to execute.
> [!TIP]
> If your application has simple requirements, you can use the <xref:System.Console.TreatControlCAsInput%2A> property instead of this event. By setting this property to `false`, you can ensure that your application always exits if the user presses Ctrl+C. By setting it to `true`, you can ensure that pressing Ctrl+C will not terminate the application.
The event handler for this event is executed on a thread pool thread.
## Examples
The following example demonstrates how the <xref:System.Console.CancelKeyPress> event is used. When you press Ctrl+C, the read operation is interrupted and the `myHandler` event handler is invoked. Upon entry to the event handler, the <xref:System.ConsoleCancelEventArgs.Cancel%2A?displayProperty=nameWithType> property is `false`, which means that the current process will terminate when the event handler terminates. However, the event handler sets the <xref:System.ConsoleCancelEventArgs.Cancel%2A?displayProperty=nameWithType> property to `true`, which means that the process will not terminate and the read operation will resume.
[!code-cpp[console.cancelkeypress#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp#1)]
[!code-csharp[console.cancelkeypress#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.cancelkeypress/cs/ckp.cs#1)]
[!code-vb[console.cancelkeypress#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb#1)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
<altmember cref="T:System.ConsoleCancelEventArgs" />
<altmember cref="T:System.ConsoleCancelEventHandler" />
<altmember cref="P:System.Console.TreatControlCAsInput" />
</Docs>
</Member>
<Member MemberName="CapsLock">
<MemberSignature Language="C#" Value="public static bool CapsLock { get; }" />
<MemberSignature Language="ILAsm" Value=".property bool CapsLock" />
<MemberSignature Language="DocId" Value="P:System.Console.CapsLock" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property CapsLock As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool CapsLock { bool get(); };" />
<MemberSignature Language="F#" Value="member this.CapsLock : bool" Usage="System.Console.CapsLock" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off.</summary>
<value>
<see langword="true" /> if CAPS LOCK is turned on; <see langword="false" /> if CAPS LOCK is turned off.</value>
<remarks>To be added.</remarks>
<exception cref="T:System.PlatformNotSupportedException">The get operation is invoked on an operating system other than Windows.</exception>
</Docs>
</Member>
<Member MemberName="Clear">
<MemberSignature Language="C#" Value="public static void Clear ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Clear() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.Clear" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Clear ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Clear();" />
<MemberSignature Language="F#" Value="static member Clear : unit -&gt; unit" Usage="System.Console.Clear " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Clears the console buffer and corresponding console window of display information.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Using the <xref:System.Console.Clear%2A> method is equivalent invoking the MS-DOS `cls` command in the command prompt window. When the <xref:System.Console.Clear%2A> method is called, the cursor automatically scrolls to the top-left corner of the window and the contents of the screen buffer are set to blanks using the current foreground background colors.
> [!NOTE]
> Attempting to call the <xref:System.Console.Clear%2A> method when a console application's output is redirected to a file throws a <xref:System.IO.IOException>. To prevent this, always wrap a call to the <xref:System.Console.Clear%2A> method in a `try`…`catch` block.
## Examples
The following example uses the <xref:System.Console.Clear%2A> method to clear the console before it executes a loop, prompts the user to select a foreground and background color and to enter a string to display. If the user chooses not to exit the program, the console's original foreground and background colors are restored and the <xref:System.Console.Clear%2A> method is called again before re-executing the loop.
[!code-csharp[System.Console.Clear#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.clear/cs/clear1.cs#1)]
[!code-vb[System.Console.Clear#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.clear/vb/clear1.vb#1)]
The example relies on a `GetKeyPress` method to validate the user's selection of a foreground and background color.
This example demonstrates the <xref:System.Console.CursorLeft%2A> and <xref:System.Console.CursorTop%2A> properties, and the <xref:System.Console.SetCursorPosition%2A> and <xref:System.Console.Clear%2A> methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "&#124;", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings.
[!code-cpp[console.cursorLTS#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp#1)]
[!code-csharp[console.cursorLTS#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.cursorLTS/CS/lts.cs#1)]
[!code-vb[console.cursorLTS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
</Docs>
</Member>
<Member MemberName="CursorLeft">
<MemberSignature Language="C#" Value="public static int CursorLeft { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property int32 CursorLeft" />
<MemberSignature Language="DocId" Value="P:System.Console.CursorLeft" />
<MemberSignature Language="VB.NET" Value="Public Shared Property CursorLeft As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int CursorLeft { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.CursorLeft : int with get, set" Usage="System.Console.CursorLeft" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the column position of the cursor within the buffer area.</summary>
<value>The current position, in columns, of the cursor.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
This example demonstrates the <xref:System.Console.CursorLeft%2A> and <xref:System.Console.CursorTop%2A> properties, and the <xref:System.Console.SetCursorPosition%2A> and <xref:System.Console.Clear%2A> methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "&#124;", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings.
[!code-cpp[console.cursorLTS#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp#1)]
[!code-csharp[console.cursorLTS#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.cursorLTS/CS/lts.cs#1)]
[!code-vb[console.cursorLTS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The value in a set operation is less than zero.
-or-
The value in a set operation is greater than or equal to <see cref="P:System.Console.BufferWidth" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="CursorSize">
<MemberSignature Language="C#" Value="public static int CursorSize { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property int32 CursorSize" />
<MemberSignature Language="DocId" Value="P:System.Console.CursorSize" />
<MemberSignature Language="VB.NET" Value="Public Shared Property CursorSize As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int CursorSize { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.CursorSize : int with get, set" Usage="System.Console.CursorSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the height of the cursor within a character cell.</summary>
<value>The size of the cursor expressed as a percentage of the height of a character cell. The property value ranges from 1 to 100.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The cursor appearance varies, ranging from a horizontal line at the bottom of the cell when the property value is 1, to completely filling the cell when the property value is 100.
## Examples
This example demonstrates the <xref:System.Console.CursorSize%2A> property. The example increases the size of the cursor each time any console key is pressed, then restores the cursor to its original size before terminating.
[!code-cpp[console.cursorsize#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp#1)]
[!code-csharp[console.cursorsize#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.cursorsize/CS/csize.cs#1)]
[!code-vb[console.cursorsize#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.cursorsize/VB/csize.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The value specified in a set operation is less than 1 or greater than 100.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.PlatformNotSupportedException">The set operation is invoked on an operating system other than Windows.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="CursorTop">
<MemberSignature Language="C#" Value="public static int CursorTop { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property int32 CursorTop" />
<MemberSignature Language="DocId" Value="P:System.Console.CursorTop" />
<MemberSignature Language="VB.NET" Value="Public Shared Property CursorTop As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int CursorTop { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.CursorTop : int with get, set" Usage="System.Console.CursorTop" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the row position of the cursor within the buffer area.</summary>
<value>The current position, in rows, of the cursor.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
This example demonstrates the <xref:System.Console.CursorLeft%2A> and <xref:System.Console.CursorTop%2A> properties, and the <xref:System.Console.SetCursorPosition%2A> and <xref:System.Console.Clear%2A> methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "&#124;", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings.
[!code-cpp[console.cursorLTS#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp#1)]
[!code-csharp[console.cursorLTS#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.cursorLTS/CS/lts.cs#1)]
[!code-vb[console.cursorLTS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The value in a set operation is less than zero.
-or-
The value in a set operation is greater than or equal to <see cref="P:System.Console.BufferHeight" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="CursorVisible">
<MemberSignature Language="C#" Value="public static bool CursorVisible { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property bool CursorVisible" />
<MemberSignature Language="DocId" Value="P:System.Console.CursorVisible" />
<MemberSignature Language="VB.NET" Value="Public Shared Property CursorVisible As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool CursorVisible { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.CursorVisible : bool with get, set" Usage="System.Console.CursorVisible" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the cursor is visible.</summary>
<value>
<see langword="true" /> if the cursor is visible; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
This example demonstrates the <xref:System.Console.CursorVisible%2A> property. The example makes the cursor visible if the first column of input is a '+' character or invisible if the input is a '-' character.
[!code-cpp[console.cursorvis#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp#1)]
[!code-csharp[console.cursorvis#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.cursorvis/CS/vis.cs#1)]
[!code-vb[console.cursorvis#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.cursorvis/VB/vis.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.PlatformNotSupportedException">The get operation is invoked on an operating system other than Windows.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="Error">
<MemberSignature Language="C#" Value="public static System.IO.TextWriter Error { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.IO.TextWriter Error" />
<MemberSignature Language="DocId" Value="P:System.Console.Error" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property Error As TextWriter" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::IO::TextWriter ^ Error { System::IO::TextWriter ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Error : System.IO.TextWriter" Usage="System.Console.Error" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.TextWriter</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the standard error output stream.</summary>
<value>A <see cref="T:System.IO.TextWriter" /> that represents the standard error output stream.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This standard error stream is set to the console by default. It can be set to another stream with the <xref:System.Console.SetError%2A> method. After the standard error stream is redirected, it can be reacquired by calling the <xref:System.Console.OpenStandardError%2A> method.
In console applications whose informational output is often redirected to a file, the standard error stream available through the <xref:System.Console.Error%2A> property can be used to display information to the console even if output is redirected. The following example displays product tables for 10 numbers at a time starting with 1. After every set of 10 numbers, the <xref:System.Console.Error%2A> property is used to ask the user whether to display the next set. If the standard output is redirected to a file, the user is still asked whether the routine should generate the next set of products.
[!code-csharp[System.Console.Error#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.error/cs/error1.cs#1)]
[!code-vb[System.Console.Error#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.error/vb/error1.vb#1)]
## Examples
The following example is a command line utility named ExpandTabs that replaces tab characters in a text file with four spaces, the value defined by the `tabSize` variable. It redirects the standard input and output streams to files, but uses the <xref:System.Console.Error%2A> property to write the standard error stream to the console. It can be launched from the command line by supplying the name of the file that contains tab characters and the name of the output file.
[!code-cpp[Console-EXPANDTABSEX#1](~/samples/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp#1)]
[!code-csharp[Console-EXPANDTABSEX#1](~/samples/snippets/csharp/VS_Snippets_CLR/Console-EXPANDTABSEX/CS/expandtabsex.cs#1)]
[!code-vb[Console-EXPANDTABSEX#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Console-EXPANDTABSEX/VB/expandtabsex.vb#1)]
The following example is a simple text file viewer that displays the contents of one or more text files to the console. If there are no command line arguments, or if any files passed as command line arguments do not exist, the example calls the <xref:System.Console.SetError%2A> method to redirect error information to a file, calls the <xref:System.Console.OpenStandardError%2A> method in the process of reacquiring the standard error stream, and indicates that error information was written to a file.
[!code-csharp[System.Console.OpenStandardError#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.openstandarderror/cs/viewtextfile.cs#1)]
[!code-vb[System.Console.OpenStandardError#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.openstandarderror/vb/viewtextfile.vb#1)]
Note that the <xref:System.IO.StreamWriter.AutoFlush%2A?displayProperty=nameWithType> property is set to `true` before reacquiring the error stream. This ensures that output will be sent to the console immediately rather than buffered.
]]></format>
</remarks>
<altmember cref="P:System.Console.In" />
<altmember cref="P:System.Console.Out" />
<altmember cref="P:System.Console.IsErrorRedirected" />
<altmember cref="M:System.Console.SetError(System.IO.TextWriter)" />
</Docs>
</Member>
<Member MemberName="ForegroundColor">
<MemberSignature Language="C#" Value="public static ConsoleColor ForegroundColor { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property valuetype System.ConsoleColor ForegroundColor" />
<MemberSignature Language="DocId" Value="P:System.Console.ForegroundColor" />
<MemberSignature Language="VB.NET" Value="Public Shared Property ForegroundColor As ConsoleColor" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property ConsoleColor ForegroundColor { ConsoleColor get(); void set(ConsoleColor value); };" />
<MemberSignature Language="F#" Value="member this.ForegroundColor : ConsoleColor with get, set" Usage="System.Console.ForegroundColor" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.ConsoleColor</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the foreground color of the console.</summary>
<value>A <see cref="T:System.ConsoleColor" /> that specifies the foreground color of the console; that is, the color of each character that is displayed. The default is gray.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A get operation for a Windows-based application, in which a console does not exist, returns <xref:System.ConsoleColor.Gray>.
## Examples
The following example checks whether the console's background color is black and, if it is, it changes the background color to red and the foreground color to black.
[!code-csharp[System.ConsoleColor#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.consolecolor/cs/Example2.cs#2)]
[!code-vb[System.ConsoleColor#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.consolecolor/vb/Example2.vb#2)]
The following example saves the values of the <xref:System.ConsoleColor> enumeration to an array and stores the current values of the <xref:System.Console.BackgroundColor%2A> and <xref:System.Console.ForegroundColor%2A> properties to variables. It then changes the foreground color to each color in the <xref:System.ConsoleColor> enumeration except to the color that matches the current background, and it changes the background color to each color in the <xref:System.ConsoleColor> enumeration except to the color that matches the current foreground. (If the foreground color is the same as the background color, the text isn't visible.) Finally, it calls the <xref:System.Console.ResetColor%2A> method to restore the original console colors.
[!code-csharp[System.ConsoleColor#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.consolecolor/cs/foregroundcolor3.cs#1)]
[!code-vb[System.ConsoleColor#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.consolecolor/vb/foregroundcolor3.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The color specified in a set operation is not a valid member of <see cref="T:System.ConsoleColor" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="In">
<MemberSignature Language="C#" Value="public static System.IO.TextReader In { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.IO.TextReader In" />
<MemberSignature Language="DocId" Value="P:System.Console.In" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property In As TextReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::IO::TextReader ^ In { System::IO::TextReader ^ get(); };" />
<MemberSignature Language="F#" Value="member this.In : System.IO.TextReader" Usage="System.Console.In" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.TextReader</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the standard input stream.</summary>
<value>A <see cref="T:System.IO.TextReader" /> that represents the standard input stream.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is set to the standard input stream by default. This property can be set to another stream with the <xref:System.Console.SetIn%2A> method.
Read operations on the standard input stream execute synchronously. That is, they block until the specified read operation has completed. This is true even if an asynchronous method, such as <xref:System.IO.TextReader.ReadLineAsync%2A>, is called on the <xref:System.IO.TextReader> object returned by the <xref:System.Console.In%2A> property.
## Examples
The following sample illustrates the use of the `In` property.
[!code-cpp[consolein#1](~/samples/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp#1)]
[!code-csharp[consolein#1](~/samples/snippets/csharp/VS_Snippets_CLR/consolein/CS/consolein.cs#1)]
[!code-vb[consolein#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/consolein/VB/consolein.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Console.OpenStandardInput" />
<altmember cref="P:System.Console.IsInputRedirected" />
<altmember cref="P:System.Console.Error" />
<altmember cref="P:System.Console.Out" />
<altmember cref="M:System.Console.SetIn(System.IO.TextReader)" />
</Docs>
</Member>
<Member MemberName="InputEncoding">
<MemberSignature Language="C#" Value="public static System.Text.Encoding InputEncoding { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Text.Encoding InputEncoding" />
<MemberSignature Language="DocId" Value="P:System.Console.InputEncoding" />
<MemberSignature Language="VB.NET" Value="Public Shared Property InputEncoding As Encoding" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::Text::Encoding ^ InputEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };" />
<MemberSignature Language="F#" Value="member this.InputEncoding : System.Text.Encoding with get, set" Usage="System.Console.InputEncoding" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Text.Encoding</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the encoding the console uses to read input.</summary>
<value>The encoding used to read console input.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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 [!INCLUDE[net_v40_long](~/includes/net-v40-long-md.md)], 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 <xref:System.Console.InputEncoding%2A> property is modified by some means other than an assignment to the <xref:System.Console.InputEncoding%2A> property, such as calling the Windows `SetConsoleCP` function or using the `chcp` command from a PowerShell script.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The property value in a set operation is <see langword="null" />.</exception>
<exception cref="T:System.IO.IOException">An error occurred during the execution of this operation.</exception>
<exception cref="T:System.Security.SecurityException">Your application does not have permission to perform this operation.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for reading and writing to top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
<altmember cref="T:System.Text.Encoding" />
</Docs>
</Member>
<Member MemberName="IsErrorRedirected">
<MemberSignature Language="C#" Value="public static bool IsErrorRedirected { get; }" />
<MemberSignature Language="ILAsm" Value=".property bool IsErrorRedirected" />
<MemberSignature Language="DocId" Value="P:System.Console.IsErrorRedirected" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property IsErrorRedirected As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool IsErrorRedirected { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsErrorRedirected : bool" Usage="System.Console.IsErrorRedirected" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that indicates whether the error output stream has been redirected from the standard error stream.</summary>
<value>
<see langword="true" /> if error output is redirected; otherwise, <see langword="false" />.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Console.Error" />
<altmember cref="M:System.Console.SetError(System.IO.TextWriter)" />
<altmember cref="M:System.Console.OpenStandardError" />
</Docs>
</Member>
<Member MemberName="IsInputRedirected">
<MemberSignature Language="C#" Value="public static bool IsInputRedirected { get; }" />
<MemberSignature Language="ILAsm" Value=".property bool IsInputRedirected" />
<MemberSignature Language="DocId" Value="P:System.Console.IsInputRedirected" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property IsInputRedirected As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool IsInputRedirected { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsInputRedirected : bool" Usage="System.Console.IsInputRedirected" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that indicates whether input has been redirected from the standard input stream.</summary>
<value>
<see langword="true" /> if input is redirected; otherwise, <see langword="false" />.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Console.In" />
<altmember cref="M:System.Console.SetIn(System.IO.TextReader)" />
<altmember cref="M:System.Console.OpenStandardInput" />
</Docs>
</Member>
<Member MemberName="IsOutputRedirected">
<MemberSignature Language="C#" Value="public static bool IsOutputRedirected { get; }" />
<MemberSignature Language="ILAsm" Value=".property bool IsOutputRedirected" />
<MemberSignature Language="DocId" Value="P:System.Console.IsOutputRedirected" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property IsOutputRedirected As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool IsOutputRedirected { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsOutputRedirected : bool" Usage="System.Console.IsOutputRedirected" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that indicates whether output has been redirected from the standard output stream.</summary>
<value>
<see langword="true" /> if output is redirected; otherwise, <see langword="false" />.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Console.Out" />
<altmember cref="M:System.Console.SetOut(System.IO.TextWriter)" />
<altmember cref="M:System.Console.OpenStandardError" />
</Docs>
</Member>
<Member MemberName="KeyAvailable">
<MemberSignature Language="C#" Value="public static bool KeyAvailable { get; }" />
<MemberSignature Language="ILAsm" Value=".property bool KeyAvailable" />
<MemberSignature Language="DocId" Value="P:System.Console.KeyAvailable" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property KeyAvailable As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool KeyAvailable { bool get(); };" />
<MemberSignature Language="F#" Value="member this.KeyAvailable : bool" Usage="System.Console.KeyAvailable" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether a key press is available in the input stream.</summary>
<value>
<see langword="true" /> if a key press is available; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The property value is returned immediately; that is, the <xref:System.Console.KeyAvailable%2A> property does not block input until a key press is available.
Use the <xref:System.Console.KeyAvailable%2A> property in conjunction with only the <xref:System.Console.ReadKey%2A> method, not the <xref:System.Console.Read%2A> or <xref:System.Console.ReadLine%2A> methods.
## Examples
The following example demonstrates how to use the <xref:System.Console.KeyAvailable%2A> property to create a loop that runs until a key is pressed.
[!code-cpp[console.keyavailable#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp#1)]
[!code-csharp[console.keyavailable#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.keyavailable/CS/ka.cs#1)]
[!code-vb[console.keyavailable#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.keyavailable/VB/ka.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.InvalidOperationException">Standard input is redirected to a file instead of the keyboard.</exception>
</Docs>
</Member>
<Member MemberName="LargestWindowHeight">
<MemberSignature Language="C#" Value="public static int LargestWindowHeight { get; }" />
<MemberSignature Language="ILAsm" Value=".property int32 LargestWindowHeight" />
<MemberSignature Language="DocId" Value="P:System.Console.LargestWindowHeight" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property LargestWindowHeight As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int LargestWindowHeight { int get(); };" />
<MemberSignature Language="F#" Value="member this.LargestWindowHeight : int" Usage="System.Console.LargestWindowHeight" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the largest possible number of console window rows, based on the current font and screen resolution.</summary>
<value>The height of the largest possible console window measured in rows.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="LargestWindowWidth">
<MemberSignature Language="C#" Value="public static int LargestWindowWidth { get; }" />
<MemberSignature Language="ILAsm" Value=".property int32 LargestWindowWidth" />
<MemberSignature Language="DocId" Value="P:System.Console.LargestWindowWidth" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property LargestWindowWidth As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int LargestWindowWidth { int get(); };" />
<MemberSignature Language="F#" Value="member this.LargestWindowWidth : int" Usage="System.Console.LargestWindowWidth" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the largest possible number of console window columns, based on the current font and screen resolution.</summary>
<value>The width of the largest possible console window measured in columns.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<MemberGroup MemberName="MoveBufferArea">
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Copies a specified source area of the screen buffer to a specified destination area.</summary>
</Docs>
</MemberGroup>
<Member MemberName="MoveBufferArea">
<MemberSignature Language="C#" Value="public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void MoveBufferArea(int32 sourceLeft, int32 sourceTop, int32 sourceWidth, int32 sourceHeight, int32 targetLeft, int32 targetTop) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.MoveBufferArea(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub MoveBufferArea (sourceLeft As Integer, sourceTop As Integer, sourceWidth As Integer, sourceHeight As Integer, targetLeft As Integer, targetTop As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop);" />
<MemberSignature Language="F#" Value="static member MoveBufferArea : int * int * int * int * int * int -&gt; unit" Usage="System.Console.MoveBufferArea (sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sourceLeft" Type="System.Int32" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceTop" Type="System.Int32" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceWidth" Type="System.Int32" Index="2" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceHeight" Type="System.Int32" Index="3" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="targetLeft" Type="System.Int32" Index="4" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="targetTop" Type="System.Int32" Index="5" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="sourceLeft">The leftmost column of the source area.</param>
<param name="sourceTop">The topmost row of the source area.</param>
<param name="sourceWidth">The number of columns in the source area.</param>
<param name="sourceHeight">The number of rows in the source area.</param>
<param name="targetLeft">The leftmost column of the destination area.</param>
<param name="targetTop">The topmost row of the destination area.</param>
<summary>Copies a specified source area of the screen buffer to a specified destination area.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the destination and source parameters specify a position located outside the boundaries of the current screen buffer, only the portion of the source area that fits within the destination area is copied. That is, the source area is clipped to fit the current screen buffer.
The <xref:System.Console.MoveBufferArea%2A> method copies the source area to the destination area. If the destination area does not intersect the source area, the source area is filled with blanks using the current foreground and background colors. Otherwise, the intersected portion of the source area is not filled.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">One or more of the parameters is less than zero.
-or-
<paramref name="sourceLeft" /> or <paramref name="targetLeft" /> is greater than or equal to <see cref="P:System.Console.BufferWidth" />.
-or-
<paramref name="sourceTop" /> or <paramref name="targetTop" /> is greater than or equal to <see cref="P:System.Console.BufferHeight" />.
-or-
<paramref name="sourceTop" /> + <paramref name="sourceHeight" /> is greater than or equal to <see cref="P:System.Console.BufferHeight" />.
-or-
<paramref name="sourceLeft" /> + <paramref name="sourceWidth" /> is greater than or equal to <see cref="P:System.Console.BufferWidth" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="MoveBufferArea">
<MemberSignature Language="C#" Value="public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void MoveBufferArea(int32 sourceLeft, int32 sourceTop, int32 sourceWidth, int32 sourceHeight, int32 targetLeft, int32 targetTop, char sourceChar, valuetype System.ConsoleColor sourceForeColor, valuetype System.ConsoleColor sourceBackColor) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.MoveBufferArea(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Char,System.ConsoleColor,System.ConsoleColor)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub MoveBufferArea (sourceLeft As Integer, sourceTop As Integer, sourceWidth As Integer, sourceHeight As Integer, targetLeft As Integer, targetTop As Integer, sourceChar As Char, sourceForeColor As ConsoleColor, sourceBackColor As ConsoleColor)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor);" />
<MemberSignature Language="F#" Value="static member MoveBufferArea : int * int * int * int * int * int * char * ConsoleColor * ConsoleColor -&gt; unit" Usage="System.Console.MoveBufferArea (sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop, sourceChar, sourceForeColor, sourceBackColor)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sourceLeft" Type="System.Int32" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceTop" Type="System.Int32" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceWidth" Type="System.Int32" Index="2" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceHeight" Type="System.Int32" Index="3" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="targetLeft" Type="System.Int32" Index="4" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="targetTop" Type="System.Int32" Index="5" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceChar" Type="System.Char" Index="6" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceForeColor" Type="System.ConsoleColor" Index="7" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="sourceBackColor" Type="System.ConsoleColor" Index="8" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="sourceLeft">The leftmost column of the source area.</param>
<param name="sourceTop">The topmost row of the source area.</param>
<param name="sourceWidth">The number of columns in the source area.</param>
<param name="sourceHeight">The number of rows in the source area.</param>
<param name="targetLeft">The leftmost column of the destination area.</param>
<param name="targetTop">The topmost row of the destination area.</param>
<param name="sourceChar">The character used to fill the source area.</param>
<param name="sourceForeColor">The foreground color used to fill the source area.</param>
<param name="sourceBackColor">The background color used to fill the source area.</param>
<summary>Copies a specified source area of the screen buffer to a specified destination area.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the destination and source parameters specify a position located beyond the boundaries of the current screen buffer, only the portion of the source area that fits within the destination area is copied. That is, the source area is clipped to fit the current screen buffer.
The <xref:System.Console.MoveBufferArea%2A> method copies the source area to the destination area. If the destination area does not intersect the source area, the source area is filled with the character specified by `sourceChar`, using the colors specified by `sourceForeColor` and `sourceBackColor`. Otherwise, the intersected portion of the source area is not filled.
The <xref:System.Console.MoveBufferArea%2A> method performs no operation if `sourceWidth` or `sourceHeight` is zero.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">One or more of the parameters is less than zero.
-or-
<paramref name="sourceLeft" /> or <paramref name="targetLeft" /> is greater than or equal to <see cref="P:System.Console.BufferWidth" />.
-or-
<paramref name="sourceTop" /> or <paramref name="targetTop" /> is greater than or equal to <see cref="P:System.Console.BufferHeight" />.
-or-
<paramref name="sourceTop" /> + <paramref name="sourceHeight" /> is greater than or equal to <see cref="P:System.Console.BufferHeight" />.
-or-
<paramref name="sourceLeft" /> + <paramref name="sourceWidth" /> is greater than or equal to <see cref="P:System.Console.BufferWidth" />.</exception>
<exception cref="T:System.ArgumentException">One or both of the color parameters is not a member of the <see cref="T:System.ConsoleColor" /> enumeration.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="NumberLock">
<MemberSignature Language="C#" Value="public static bool NumberLock { get; }" />
<MemberSignature Language="ILAsm" Value=".property bool NumberLock" />
<MemberSignature Language="DocId" Value="P:System.Console.NumberLock" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property NumberLock As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool NumberLock { bool get(); };" />
<MemberSignature Language="F#" Value="member this.NumberLock : bool" Usage="System.Console.NumberLock" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off.</summary>
<value>
<see langword="true" /> if NUM LOCK is turned on; <see langword="false" /> if NUM LOCK is turned off.</value>
<remarks>To be added.</remarks>
<exception cref="T:System.PlatformNotSupportedException">The get operation is invoked on an operating system other than Windows.</exception>
</Docs>
</Member>
<MemberGroup MemberName="OpenStandardError">
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Acquires the standard error stream.</summary>
</Docs>
</MemberGroup>
<Member MemberName="OpenStandardError">
<MemberSignature Language="C#" Value="public static System.IO.Stream OpenStandardError ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.IO.Stream OpenStandardError() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.OpenStandardError" />
<MemberSignature Language="VB.NET" Value="Public Shared Function OpenStandardError () As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::IO::Stream ^ OpenStandardError();" />
<MemberSignature Language="F#" Value="static member OpenStandardError : unit -&gt; System.IO.Stream" Usage="System.Console.OpenStandardError " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Acquires the standard error stream.</summary>
<returns>The standard error stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to reacquire the standard error stream after it has been changed by the <xref:System.Console.SetError%2A> method.
## Examples
The following example is a simple text file viewer that displays the contents of one or more text files to the console. If there are no command line arguments, or if any files passed as command line arguments do not exist, the example calls the <xref:System.Console.SetError%2A> method to redirect error information to a file, calls the <xref:System.Console.OpenStandardError%2A> method in the process of reacquiring the standard error stream, and indicates that error information was written to a file.
[!code-csharp[System.Console.OpenStandardError#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.openstandarderror/cs/viewtextfile.cs#1)]
[!code-vb[System.Console.OpenStandardError#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.openstandarderror/vb/viewtextfile.vb#1)]
Note that the <xref:System.IO.StreamWriter.AutoFlush%2A?displayProperty=nameWithType> property is set to `true` before reacquiring the error stream. This ensures that output will be sent to the console immediately rather than buffered.
]]></format>
</remarks>
<altmember cref="P:System.Console.Error" />
<altmember cref="P:System.Console.IsErrorRedirected" />
<altmember cref="M:System.Console.SetError(System.IO.TextWriter)" />
</Docs>
</Member>
<Member MemberName="OpenStandardError">
<MemberSignature Language="C#" Value="public static System.IO.Stream OpenStandardError (int bufferSize);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.IO.Stream OpenStandardError(int32 bufferSize) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.OpenStandardError(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function OpenStandardError (bufferSize As Integer) As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::IO::Stream ^ OpenStandardError(int bufferSize);" />
<MemberSignature Language="F#" Value="static member OpenStandardError : int -&gt; System.IO.Stream" Usage="System.Console.OpenStandardError bufferSize" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="bufferSize" Type="System.Int32" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="bufferSize">The internal stream buffer size.</param>
<summary>Acquires the standard error stream, which is set to a specified buffer size.</summary>
<returns>The standard error stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to reacquire the standard error stream after it has been changed by the <xref:System.Console.SetError%2A> method.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="bufferSize" /> is less than or equal to zero.</exception>
<altmember cref="P:System.Console.Error" />
<altmember cref="P:System.Console.IsErrorRedirected" />
<altmember cref="M:System.Console.SetError(System.IO.TextWriter)" />
</Docs>
</Member>
<MemberGroup MemberName="OpenStandardInput">
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Acquires the standard input stream.</summary>
</Docs>
</MemberGroup>
<Member MemberName="OpenStandardInput">
<MemberSignature Language="C#" Value="public static System.IO.Stream OpenStandardInput ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.IO.Stream OpenStandardInput() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.OpenStandardInput" />
<MemberSignature Language="VB.NET" Value="Public Shared Function OpenStandardInput () As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::IO::Stream ^ OpenStandardInput();" />
<MemberSignature Language="F#" Value="static member OpenStandardInput : unit -&gt; System.IO.Stream" Usage="System.Console.OpenStandardInput " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Acquires the standard input stream.</summary>
<returns>The standard input stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to reacquire the standard input stream after it has been changed by the <xref:System.Console.SetIn%2A> method.
## Examples
The following example illustrates the use of the `OpenStandardInput` property.
[!code-cpp[System.Console.OpenStandartInput#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp#1)]
[!code-csharp[System.Console.OpenStandartInput#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CS/decode.cs#1)]
[!code-vb[System.Console.OpenStandartInput#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.OpenStandartInput/VB/decode.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Console.In" />
<altmember cref="P:System.Console.IsInputRedirected" />
<altmember cref="M:System.Console.SetIn(System.IO.TextReader)" />
</Docs>
</Member>
<Member MemberName="OpenStandardInput">
<MemberSignature Language="C#" Value="public static System.IO.Stream OpenStandardInput (int bufferSize);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.IO.Stream OpenStandardInput(int32 bufferSize) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.OpenStandardInput(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function OpenStandardInput (bufferSize As Integer) As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::IO::Stream ^ OpenStandardInput(int bufferSize);" />
<MemberSignature Language="F#" Value="static member OpenStandardInput : int -&gt; System.IO.Stream" Usage="System.Console.OpenStandardInput bufferSize" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="bufferSize" Type="System.Int32" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="bufferSize">The internal stream buffer size.</param>
<summary>Acquires the standard input stream, which is set to a specified buffer size.</summary>
<returns>The standard input stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to reacquire the standard output stream after it has been changed by the <xref:System.Console.SetIn%2A> method.
## Examples
The following example illustrates the use of the `OpenStandardInput` property.
[!code-cpp[System.Console.OpenStandartInput#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp#1)]
[!code-csharp[System.Console.OpenStandartInput#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CS/decode.cs#1)]
[!code-vb[System.Console.OpenStandartInput#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.OpenStandartInput/VB/decode.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="bufferSize" /> is less than or equal to zero.</exception>
<altmember cref="P:System.Console.In" />
<altmember cref="P:System.Console.IsInputRedirected" />
<altmember cref="M:System.Console.SetIn(System.IO.TextReader)" />
</Docs>
</Member>
<MemberGroup MemberName="OpenStandardOutput">
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Acquires the standard output stream.</summary>
</Docs>
</MemberGroup>
<Member MemberName="OpenStandardOutput">
<MemberSignature Language="C#" Value="public static System.IO.Stream OpenStandardOutput ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.IO.Stream OpenStandardOutput() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.OpenStandardOutput" />
<MemberSignature Language="VB.NET" Value="Public Shared Function OpenStandardOutput () As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::IO::Stream ^ OpenStandardOutput();" />
<MemberSignature Language="F#" Value="static member OpenStandardOutput : unit -&gt; System.IO.Stream" Usage="System.Console.OpenStandardOutput " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Acquires the standard output stream.</summary>
<returns>The standard output stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to reacquire the standard output stream after it has been changed by the <xref:System.Console.SetOut%2A> method.
## Examples
The following example illustrates the use of the <xref:System.Console.OpenStandardOutput%2A> method. It replaces four consecutive space characters in a string with a tab character. To run it, you must supply two command-line arguments. The first is the name of an existing text file to redirect the standard input stream to. The second is the name of a file to redirect the standard output stream to. This file need not exist. If it does, its contents will be overwritten.
[!code-cpp[System.Console-INSERTTABS#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp#1)]
[!code-csharp[System.Console-INSERTTABS#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CS/inserttabs.cs#1)]
[!code-vb[System.Console-INSERTTABS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Console.Out" />
<altmember cref="P:System.Console.IsOutputRedirected" />
<altmember cref="M:System.Console.SetOut(System.IO.TextWriter)" />
</Docs>
</Member>
<Member MemberName="OpenStandardOutput">
<MemberSignature Language="C#" Value="public static System.IO.Stream OpenStandardOutput (int bufferSize);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.IO.Stream OpenStandardOutput(int32 bufferSize) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.OpenStandardOutput(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function OpenStandardOutput (bufferSize As Integer) As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::IO::Stream ^ OpenStandardOutput(int bufferSize);" />
<MemberSignature Language="F#" Value="static member OpenStandardOutput : int -&gt; System.IO.Stream" Usage="System.Console.OpenStandardOutput bufferSize" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="bufferSize" Type="System.Int32" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="bufferSize">The internal stream buffer size.</param>
<summary>Acquires the standard output stream, which is set to a specified buffer size.</summary>
<returns>The standard output stream.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to reacquire the standard output stream after it has been changed by the <xref:System.Console.SetOut%2A> method.
## Examples
The following example illustrates the use of the <xref:System.Console.OpenStandardOutput%2A> method. It replaces four consecutive space characters in a string with a tab character. To run it, you must supply two command line arguments. The first is the name of an existing text file to redirect the standard input stream to. The second is the name of a file to redirect the standard output stream to. This file need not exist. If it does, its contents will be overwritten.
[!code-cpp[System.Console-INSERTTABS#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp#1)]
[!code-csharp[System.Console-INSERTTABS#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CS/inserttabs.cs#1)]
[!code-vb[System.Console-INSERTTABS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="bufferSize" /> is less than or equal to zero.</exception>
<altmember cref="P:System.Console.Out" />
<altmember cref="P:System.Console.IsOutputRedirected" />
<altmember cref="M:System.Console.SetOut(System.IO.TextWriter)" />
</Docs>
</Member>
<Member MemberName="Out">
<MemberSignature Language="C#" Value="public static System.IO.TextWriter Out { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.IO.TextWriter Out" />
<MemberSignature Language="DocId" Value="P:System.Console.Out" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property Out As TextWriter" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::IO::TextWriter ^ Out { System::IO::TextWriter ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Out : System.IO.TextWriter" Usage="System.Console.Out" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.TextWriter</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the standard output stream.</summary>
<value>A <see cref="T:System.IO.TextWriter" /> that represents the standard output stream.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is set to the standard output stream by default. This property can be set to another stream with the <xref:System.Console.SetOut%2A> method.
Note that calls to `Console.Out.WriteLine` methods are equivalent to calls to the corresponding <xref:System.Console.WriteLine%2A> methods.
## Examples
The following example uses the <xref:System.Console.Out%2A> property to display an array containing the names of files in the application's current directory to the standard output device. It then sets the standard output to a file named Files.txt and lists the array elements to the file. Finally, it sets the output to the standard output stream and again displays the array elements to the standard output device.
[!code-csharp[System.Console.Out#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.out/cs/out1.cs#1)]
[!code-vb[System.Console.Out#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.out/vb/out1.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Console.Error" />
<altmember cref="P:System.Console.In" />
<altmember cref="M:System.Console.SetOut(System.IO.TextWriter)" />
</Docs>
</Member>
<Member MemberName="OutputEncoding">
<MemberSignature Language="C#" Value="public static System.Text.Encoding OutputEncoding { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Text.Encoding OutputEncoding" />
<MemberSignature Language="DocId" Value="P:System.Console.OutputEncoding" />
<MemberSignature Language="VB.NET" Value="Public Shared Property OutputEncoding As Encoding" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::Text::Encoding ^ OutputEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };" />
<MemberSignature Language="F#" Value="member this.OutputEncoding : System.Text.Encoding with get, set" Usage="System.Console.OutputEncoding" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Text.Encoding</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the encoding the console uses to write output.</summary>
<value>The encoding used to write console output.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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 [!INCLUDE[net_v40_long](~/includes/net-v40-long-md.md)], a property get operation may return a cached value instead of the console's current output encoding. This can occur if the value of the <xref:System.Console.OutputEncoding%2A> property is modified by some means other than an assignment to the <xref:System.Console.OutputEncoding%2A> property, such as calling the Windows `SetConsoleOutputCP` function.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The property value in a set operation is <see langword="null" />.</exception>
<exception cref="T:System.IO.IOException">An error occurred during the execution of this operation.</exception>
<exception cref="T:System.Security.SecurityException">Your application does not have permission to perform this operation.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for reading and writing to top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
<block subset="none" type="usage">
<para>Of the Unicode encodings, the <see cref="T:System.Console" /> class supports UTF-8 encoding with the <see cref="T:System.Text.UTF8Encoding" /> class and, starting with the [!INCLUDE[net_v45](~/includes/net-v45-md.md)], it supports UTF-16 encoding with the <see cref="T:System.Text.UnicodeEncoding" /> class. UTF-32 encoding with the <see cref="T:System.Text.UTF32Encoding" /> class is not supported. Attempting to set the output encoding to UTF-32 throws an <see cref="T:System.IO.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 <see cref="T:System.Console" /> class.</para>
</block>
</Docs>
</Member>
<Member MemberName="Read">
<MemberSignature Language="C#" Value="public static int Read ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig int32 Read() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.Read" />
<MemberSignature Language="VB.NET" Value="Public Shared Function Read () As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static int Read();" />
<MemberSignature Language="F#" Value="static member Read : unit -&gt; int" Usage="System.Console.Read " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Reads the next character from the standard input stream.</summary>
<returns>The next character from the input stream, or negative one (-1) if there are currently no more characters to be read.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Console.Read%2A> method blocks its return while you type input characters; it terminates when you press the <xref:System.ConsoleKey.Enter> key. Pressing Enter appends a platform-dependent line termination sequence to your input (for example, Windows appends a carriage return-linefeed sequence). Subsequent calls to the <xref:System.Console.Read%2A> method retrieve your input one character at a time. After the final character is retrieved, <xref:System.Console.Read%2A> blocks its return again and the cycle repeats.
> [!IMPORTANT]
> The <xref:System.Console.ReadLine%2A> method, or the <xref:System.Console.KeyAvailable%2A> property and <xref:System.Console.ReadKey%2A> method are preferable to using the <xref:System.Console.Read%2A> method.
Note that the method does not return -1 unless you perform one of the following actions:
- Simultaneously press the <xref:System.ConsoleModifiers.Control> modifier key and <xref:System.ConsoleKey.Z> console key (Ctrl+Z), which signals the end-of-file condition.
- Press an equivalent key that signals the end-of-file condition, such as the F6 function key in Windows.
- Redirect the input stream to a source, such as a text file, that has an actual end-of-file character.
## Examples
The following example demonstrates the <xref:System.Console.Read%2A> method.
[!code-cpp[console.read#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp#1)]
[!code-csharp[console.read#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.read/CS/read.cs#1)]
[!code-vb[console.read#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.read/VB/read.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<altmember cref="M:System.Console.ReadLine" />
<altmember cref="M:System.Console.Write(System.String,System.Object)" />
<altmember cref="M:System.Console.WriteLine" />
</Docs>
</Member>
<MemberGroup MemberName="ReadKey">
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Obtains the next character or function key pressed by the user.</summary>
</Docs>
</MemberGroup>
<Member MemberName="ReadKey">
<MemberSignature Language="C#" Value="public static ConsoleKeyInfo ReadKey ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.ConsoleKeyInfo ReadKey() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.ReadKey" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ReadKey () As ConsoleKeyInfo" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static ConsoleKeyInfo ReadKey();" />
<MemberSignature Language="F#" Value="static member ReadKey : unit -&gt; ConsoleKeyInfo" Usage="System.Console.ReadKey " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ConsoleKeyInfo</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window.</summary>
<returns>An object that describes the <see cref="T:System.ConsoleKey" /> constant and Unicode character, if any, that correspond to the pressed console key. The <see cref="T:System.ConsoleKeyInfo" /> object also describes, in a bitwise combination of <see cref="T:System.ConsoleModifiers" /> values, whether one or more Shift, Alt, or Ctrl modifier keys was pressed simultaneously with the console key.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Console.ReadKey%2A> method waits, that is, blocks on the thread issuing the <xref:System.Console.ReadKey%2A> method, until a character or function key is pressed. A character or function key can be pressed in combination with one or more Alt, Ctrl, or Shift modifier keys. However, pressing a modifier key by itself will not cause the <xref:System.Console.ReadKey%2A> method to return.
Depending on your application, you might want to use the <xref:System.Console.ReadKey%2A> method in conjunction with the <xref:System.Console.KeyAvailable%2A> property.
The <xref:System.Console.ReadKey%2A> method reads from the keyboard even if the standard input is redirected to a file with the <xref:System.Console.SetIn%2A> method.
## Examples
One of the most common uses of the <xref:System.Console.ReadKey> method is to halt program execution until the user presses a key and the app either terminates or displays an additional window of information. The following example uses the <xref:System.Console.ReadKey> method to wait for the user to press the Enter key before terminating the app.
[!code-csharp[System.Console.ReadKey#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Console.ReadKey/cs/ReadKey1.cs#1)]
[!code-vb[System.Console.ReadKey#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Console.ReadKey/vb/ReadKey1.vb#1)]
Note that this overload of the <xref:System.Console.ReadKey%2A> method by default echoes any displayable keys that the user presses to the console. To suppress them, call the <xref:System.Console.ReadKey%2A> method with an `intercept` argument of `true`.
The following example uses the <xref:System.Console.ReadKey> method to display information about which key the user pressed.
[!code-cpp[console.readkey1#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp#1)]
[!code-csharp[console.readkey1#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.readkey1/CS/rk.cs#1)]
[!code-vb[console.readkey1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The <see cref="P:System.Console.In" /> property is redirected from some stream other than the console.</exception>
<altmember cref="T:System.ConsoleKey" />
<altmember cref="P:System.Console.KeyAvailable" />
<altmember cref="P:System.Console.TreatControlCAsInput" />
<altmember cref="E:System.Console.CancelKeyPress" />
</Docs>
</Member>
<Member MemberName="ReadKey">
<MemberSignature Language="C#" Value="public static ConsoleKeyInfo ReadKey (bool intercept);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.ConsoleKeyInfo ReadKey(bool intercept) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.ReadKey(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ReadKey (intercept As Boolean) As ConsoleKeyInfo" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static ConsoleKeyInfo ReadKey(bool intercept);" />
<MemberSignature Language="F#" Value="static member ReadKey : bool -&gt; ConsoleKeyInfo" Usage="System.Console.ReadKey intercept" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.ConsoleKeyInfo</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="intercept" Type="System.Boolean" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="intercept">Determines whether to display the pressed key in the console window. <see langword="true" /> to not display the pressed key; otherwise, <see langword="false" />.</param>
<summary>Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window.</summary>
<returns>An object that describes the <see cref="T:System.ConsoleKey" /> constant and Unicode character, if any, that correspond to the pressed console key. The <see cref="T:System.ConsoleKeyInfo" /> object also describes, in a bitwise combination of <see cref="T:System.ConsoleModifiers" /> values, whether one or more Shift, Alt, or Ctrl modifier keys was pressed simultaneously with the console key.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Console.ReadKey%2A> method waits, that is, blocks on the thread issuing the <xref:System.Console.ReadKey%2A> method, until a character or function key is pressed. A character or function key can be pressed in combination with one or more Alt, Ctrl, or Shift modifier keys. However, pressing a modifier key by itself will not cause the <xref:System.Console.ReadKey%2A> method to return.
If the `intercept` parameter is `true`, the pressed key is intercepted and not displayed in the console window; otherwise, the pressed key is displayed.
Depending on your application, you might want to use the <xref:System.Console.ReadKey%2A> method in conjunction with the <xref:System.Console.KeyAvailable%2A> property.
The <xref:System.Console.ReadKey%2A> method reads from the keyboard even if the standard input is redirected to a file with the <xref:System.Console.SetIn%2A> method.
## Examples
One of the most common uses of the <xref:System.Console.ReadKey%2A> method is to halt program execution until the user presses a key and the app either terminates or displays an additional window of information. The following example uses the <xref:System.Console.ReadKey%28System.Boolean%29> method to wait for the user to press the Enter key before terminating the app. Note that, if the user presses any other key, it is not echoed to the console.
[!code-csharp[System.Console.ReadKey#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Console.ReadKey/cs/ReadKey2.cs#2)]
[!code-vb[System.Console.ReadKey#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Console.ReadKey/vb/ReadKey2.vb#2)]
The following example uses the <xref:System.Console.ReadKey%28System.Boolean%29> method to display information about the key pressed by a user without echoing that key to the console.
[!code-cpp[console.readkey2#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp#1)]
[!code-csharp[console.readkey2#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.readkey2/CS/rkbool.cs#1)]
[!code-vb[console.readkey2#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.readkey2/VB/rkbool.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The <see cref="P:System.Console.In" /> property is redirected from some stream other than the console.</exception>
<altmember cref="T:System.ConsoleKey" />
<altmember cref="P:System.Console.KeyAvailable" />
<altmember cref="P:System.Console.TreatControlCAsInput" />
<altmember cref="E:System.Console.CancelKeyPress" />
</Docs>
</Member>
<Member MemberName="ReadLine">
<MemberSignature Language="C#" Value="public static string ReadLine ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string ReadLine() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.ReadLine" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ReadLine () As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::String ^ ReadLine();" />
<MemberSignature Language="F#" Value="static member ReadLine : unit -&gt; string" Usage="System.Console.ReadLine " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Reads the next line of characters from the standard input stream.</summary>
<returns>The next line of characters from the input stream, or <see langword="null" /> if no more lines are available.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Console.ReadLine%2A> method reads a line from the standard input stream. (For the definition of a line, see the paragraph after the following list.) This means that:
- If the standard input device is the keyboard, the <xref:System.Console.ReadLine%2A> method blocks until the user presses the **Enter** key.
One of the most common uses of the <xref:System.Console.ReadLine%2A> method is to pause program execution before clearing the console and displaying new information to it, or to prompt the user to press the Enter key before terminating the application. The following example illustrates this.
[!code-cpp[System.Console.ReadLine#6](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp#6)]
[!code-csharp[System.Console.ReadLine#6](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console.ReadLine/cs/ReadLineSimple.cs#6)]
[!code-vb[System.Console.ReadLine#6](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.ReadLine/vb/ReadLineSimple.vb#6)]
- If standard input is redirected to a file, the <xref:System.Console.ReadLine%2A> method reads a line of text from a file. For example, the following is a text file named ReadLine1.txt:
```
This is the first line.
This is the second line.
This is the third line.
This is the fourth line.
```
The following example uses the <xref:System.Console.ReadLine%2A> method to read input that is redirected from a file. The read operation terminates when the method returns `null`, which indicates that no lines remain to be read.
[!code-csharp[System.Console.ReadLine#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console.ReadLine/cs/ReadLine3.cs#3)]
[!code-vb[System.Console.ReadLine#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.ReadLine/vb/ReadLine3.vb#3)]
After compiling the example to an executable named ReadLine1.exe, you can run it from the command line with the syntax
```
ReadLine1 < ReadLine1.txt
```
to read the contents of the file and display them to the console.
A line is defined as a sequence of characters followed by a carriage return (hexadecimal 0x000d), a line feed (hexadecimal 0x000a), or the value of the <xref:System.Environment.NewLine%2A?displayProperty=nameWithType> property. The returned string does not contain the terminating character(s). By default, the method reads input from a 256-character input buffer. Because this includes the <xref:System.Environment.NewLine%2A?displayProperty=nameWithType> character(s), the method can read lines that contain up to 254 characters. To read longer lines, call the <xref:System.Console.OpenStandardInput%28System.Int32%29> method.
The <xref:System.Console.ReadLine%2A> method executes synchronously. That is, it blocks until a line is read or the Ctrl+Z keyboard combination is pressed. The <xref:System.Console.In%2A> property returns a <xref:System.IO.TextReader> object that represents the standard input stream and that has both a synchronous <xref:System.IO.TextReader.ReadLine%2A?displayProperty=nameWithType> method and an asynchronous <xref:System.IO.TextReader.ReadLineAsync%2A?displayProperty=nameWithType> method. However, when used as the console's standard input stream, the <xref:System.IO.TextReader.ReadLineAsync%2A?displayProperty=nameWithType> executes synchronously rather than asynchronously and returns a `Task<String>` only after the read operation has completed.
If this method throws an <xref:System.OutOfMemoryException> exception, the reader's position in the underlying <xref:System.IO.Stream> object is advanced by the number of characters the method was able to read, but the characters already read into the internal <xref:System.Console.ReadLine%2A> buffer are discarded. Since the position of the reader in the stream cannot be changed, the characters already read are unrecoverable, and can be accessed only by reinitializing the <xref:System.IO.TextReader>. If the initial position within the stream is unknown or the stream does not support seeking, the underlying <xref:System.IO.Stream> also needs to be reinitialized. To avoid such a situation and to produce robust code, you should use the <xref:System.Console.KeyAvailable%2A> property and <xref:System.Console.ReadKey%2A> method and store the read characters in a pre-allocated buffer.
If the Ctrl+Z character is pressed when the method is reading input from the console, the method returns `null`. This enables the user to prevent further keyboard input when the <xref:System.Console.ReadLine%2A> method is called in a loop. The following example illustrates this scenario.
[!code-cpp[System.Console.ReadLine#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp#1)]
[!code-csharp[System.Console.ReadLine#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console.ReadLine/cs/ReadLine2.cs#1)]
[!code-vb[System.Console.ReadLine#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.ReadLine/vb/ReadLine2.vb#1)]
## Examples
The following example requires two command line arguments: the name of an existing text file, and the name of a file to write the output to. It opens the existing text file and redirects the standard input from the keyboard to that file. It also redirects the standard output from the console to the output file. It then uses the <xref:System.Console.ReadLine%2A?displayProperty=nameWithType> method to read each line in the file, replaces every sequence of four spaces with a tab character, and uses the <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> method to write the result to the output file.
[!code-cpp[System.Console-INSERTTABS#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp#1)]
[!code-csharp[System.Console-INSERTTABS#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CS/inserttabs.cs#1)]
[!code-vb[System.Console-INSERTTABS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.OutOfMemoryException">There is insufficient memory to allocate a buffer for the returned string.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The number of characters in the next line of characters is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
<altmember cref="M:System.Console.Read" />
<altmember cref="M:System.Console.Write(System.String,System.Object)" />
<altmember cref="M:System.Console.WriteLine" />
</Docs>
</Member>
<Member MemberName="ResetColor">
<MemberSignature Language="C#" Value="public static void ResetColor ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void ResetColor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.ResetColor" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub ResetColor ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void ResetColor();" />
<MemberSignature Language="F#" Value="static member ResetColor : unit -&gt; unit" Usage="System.Console.ResetColor " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Sets the foreground and background console colors to their defaults.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The foreground and background colors are restored to the colors that existed when the current process began. For more information, see the <xref:System.Console.ForegroundColor%2A> and <xref:System.Console.BackgroundColor%2A> properties.
## Examples
The following example saves the values of the <xref:System.ConsoleColor> enumeration to an array and stores the current values of the <xref:System.Console.BackgroundColor%2A> and <xref:System.Console.ForegroundColor%2A> properties to variables. It then changes the foreground color to each color in the <xref:System.ConsoleColor> enumeration except to the color that matches the current background, and it changes the background color to each color in the <xref:System.ConsoleColor> enumeration except to the color that matches the current foreground. (If the foreground color is the same as the background color, the text isn't visible.) Finally, it calls the <xref:System.Console.ResetColor%2A> method to restore the original console colors.
[!code-csharp[System.ConsoleColor#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.consolecolor/cs/foregroundcolor3.cs#1)]
[!code-vb[System.ConsoleColor#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.consolecolor/vb/foregroundcolor3.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="SetBufferSize">
<MemberSignature Language="C#" Value="public static void SetBufferSize (int width, int height);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetBufferSize(int32 width, int32 height) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.SetBufferSize(System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub SetBufferSize (width As Integer, height As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void SetBufferSize(int width, int height);" />
<MemberSignature Language="F#" Value="static member SetBufferSize : int * int -&gt; unit" Usage="System.Console.SetBufferSize (width, height)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="width" Type="System.Int32" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="height" Type="System.Int32" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="width">The width of the buffer area measured in columns.</param>
<param name="height">The height of the buffer area measured in rows.</param>
<summary>Sets the height and width of the screen buffer area to the specified values.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example demonstrates the <xref:System.Console.WindowLeft%2A>, <xref:System.Console.WindowTop%2A>, <xref:System.Console.WindowWidth%2A>, <xref:System.Console.WindowHeight%2A>, <xref:System.Console.BufferWidth%2A>, <xref:System.Console.BufferHeight%2A>, and <xref:System.Console.CursorVisible%2A> properties; and the <xref:System.Console.SetWindowPosition%2A>, <xref:System.Console.SetBufferSize%2A>, and <xref:System.Console.ReadKey%2A> methods. The example draws a grid pattern in the screen buffer based on the screen buffer width. Then the example moves the console window in response to which of the UP ARROW, DOWN ARROW, LEFT ARROW, or RIGHT ARROW console keys is pressed. The grid pattern helps you see the movement of the console window relative to the screen buffer.
[!code-cpp[console.windowLT#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp#1)]
[!code-csharp[console.windowLT#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.windowLT/CS/wlt.cs#1)]
[!code-vb[console.windowLT#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.windowLT/VB/wlt.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="height" /> or <paramref name="width" /> is less than or equal to zero.
-or-
<paramref name="height" /> or <paramref name="width" /> is greater than or equal to <see cref="F:System.Int16.MaxValue" />.
-or-
<paramref name="width" /> is less than <see cref="P:System.Console.WindowLeft" /> + <see cref="P:System.Console.WindowWidth" />.
-or-
<paramref name="height" /> is less than <see cref="P:System.Console.WindowTop" /> + <see cref="P:System.Console.WindowHeight" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="SetCursorPosition">
<MemberSignature Language="C#" Value="public static void SetCursorPosition (int left, int top);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetCursorPosition(int32 left, int32 top) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.SetCursorPosition(System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub SetCursorPosition (left As Integer, top As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void SetCursorPosition(int left, int top);" />
<MemberSignature Language="F#" Value="static member SetCursorPosition : int * int -&gt; unit" Usage="System.Console.SetCursorPosition (left, top)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="left" Type="System.Int32" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="top" Type="System.Int32" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="left">The column position of the cursor. Columns are numbered from left to right starting at 0.</param>
<param name="top">The row position of the cursor. Rows are numbered from top to bottom starting at 0.</param>
<summary>Sets the position of the cursor.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Console.SetCursorPosition%2A> method to specify where the next write operation in the console window is to begin. If the specified cursor position is outside the area that is currently visible in the console window, the window origin changes automatically to make the cursor visible.
The cursor automatically moves to the next character position each time a character is written to the console window. If the cursor is at the bottom right character position of the console window, the next write operation causes the console window to scroll so the cursor remains visible. If you want to write a character to the bottom right character position without causing the console window to scroll, use the <xref:System.Console.MoveBufferArea%2A> method to move a character to that position.
## Examples
This example demonstrates the <xref:System.Console.CursorLeft%2A> and <xref:System.Console.CursorTop%2A> properties, and the <xref:System.Console.SetCursorPosition%2A> and <xref:System.Console.Clear%2A> methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "&#124;", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings.
[!code-cpp[console.cursorLTS#1](~/samples/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp#1)]
[!code-csharp[console.cursorLTS#1](~/samples/snippets/csharp/VS_Snippets_CLR/console.cursorLTS/CS/lts.cs#1)]
[!code-vb[console.cursorLTS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="left" /> or <paramref name="top" /> is less than zero.
-or-
<paramref name="left" /> is greater than or equal to <see cref="P:System.Console.BufferWidth" />.
-or-
<paramref name="top" /> is greater than or equal to <see cref="P:System.Console.BufferHeight" />.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have permission to perform this action.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<permission cref="T:System.Security.Permissions.UIPermission">for modifying safe top-level windows and subwindows. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /></permission>
</Docs>
</Member>
<Member MemberName="SetError">
<MemberSignature Language="C#" Value="public static void SetError (System.IO.TextWriter newError);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetError(class System.IO.TextWriter newError) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.SetError(System.IO.TextWriter)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub SetError (newError As TextWriter)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void SetError(System::IO::TextWriter ^ newError);" />
<MemberSignature Language="F#" Value="static member SetError : System.IO.TextWriter -&gt; unit" Usage="System.Console.SetError newError" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="newError" Type="System.IO.TextWriter" />
</Parameters>
<Docs>
<param name="newError">A stream that is the new standard error output.</param>
<summary>Sets the <see cref="P:System.Console.Error" /> property to the specified <see cref="T:System.IO.TextWriter" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the <xref:System.Console.Error%2A> property is set to the standard error output stream.
A <xref:System.IO.StreamWriter> that encapsulates a <xref:System.IO.FileStream> can be used to send error messages to a file.
## Examples
The following example shows how to redirect the standard error stream to a file.
[!code-cpp[System.Console.SetError#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp#1)]
[!code-csharp[System.Console.SetError#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console.SetError/cs/SetError1.cs#1)]
[!code-vb[System.Console.SetError#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.SetError/vb/SetError1.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="newError" /> is <see langword="null" />.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<permission cref="T:System.Security.Permissions.SecurityPermission">for calling unmanaged code. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
<altmember cref="P:System.Console.IsErrorRedirected" />
<altmember cref="P:System.Console.Error" />
</Docs>
</Member>
<Member MemberName="SetIn">
<MemberSignature Language="C#" Value="public static void SetIn (System.IO.TextReader newIn);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetIn(class System.IO.TextReader newIn) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.SetIn(System.IO.TextReader)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub SetIn (newIn As TextReader)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void SetIn(System::IO::TextReader ^ newIn);" />
<MemberSignature Language="F#" Value="static member SetIn : System.IO.TextReader -&gt; unit" Usage="System.Console.SetIn newIn" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="newIn" Type="System.IO.TextReader" />
</Parameters>
<Docs>
<param name="newIn">A stream that is the new standard input.</param>
<summary>Sets the <see cref="P:System.Console.In" /> property to the specified <see cref="T:System.IO.TextReader" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the <xref:System.Console.In%2A> property is set to the standard input stream.
A <xref:System.IO.StreamReader> that encapsulates a <xref:System.IO.FileStream> can be used to receive input from a file.
## Examples
The following example illustrates the use of the <xref:System.Console.SetIn%2A> method. It replaces four consecutive space characters in a string with a tab character. To run it, you must supply two command line arguments. The first is the name of an existing text file to redirect the standard input stream to. The second is the name of a file to redirect the standard output stream to. This file need not exist. If it does, its contents will be overwritten.
[!code-cpp[System.Console-INSERTTABS#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp#1)]
[!code-csharp[System.Console-INSERTTABS#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CS/inserttabs.cs#1)]
[!code-vb[System.Console-INSERTTABS#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="newIn" /> is <see langword="null" />.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<permission cref="T:System.Security.Permissions.SecurityPermission">for calling unmanaged code. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
<altmember cref="T:System.IO.TextReader" />
<altmember cref="P:System.Console.In" />
</Docs>
</Member>
<Member MemberName="SetOut">
<MemberSignature Language="C#" Value="public static void SetOut (System.IO.TextWriter newOut);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetOut(class System.IO.TextWriter newOut) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Console.SetOut(System.IO.TextWriter)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub SetOut (newOut As TextWriter)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void SetOut(System::IO::TextWriter ^ newOut);" />
<MemberSignature Language="F#" Value="static member SetOut : System.IO.TextWriter -&gt; unit" Usage="System.Console.SetOut newOut" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Console</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>