System.Console Class

public sealed class Console

Base Types

Object
  Console

Assembly

mscorlib

Library

BCL

Summary

Represents the standard input, output, and error streams for console applications.

Description

The Console class provides basic input and output support for applications that read from and write characters to the console. If the console does not exist, as in a GUI application, writing to the console produces no result, and no exception is raised.

The standard input, output, and error streams are represented by properties, and are automatically associated with the console when the application starts. Applications can redirect these properties to other streams; for example, streams associated with files instead of the console. [Note: For additional information see the System.Console.SetIn(System.IO.TextReader), System.Console.SetOut(System.IO.TextWriter), and System.Console.SetError(System.IO.TextWriter) methods.]

By default, the read methods in this class use the standard input stream and the write methods use the standard output stream.

The write methods support writing data with or without automatically appending carriage return and linefeed characters. This enables the writing of strings, formatted strings, arrays of characters, instances of primitive types, and arbitrary objects without first having to convert them to strings.

This class uses synchronized TextReader and TextWriter instances. Multiple threads can concurrently read from and/or write to an instance of this type.

Example

The following example demonstrates the use of basic Console input and output functions. The program waits for the user to enter a name.

using System;

public class ConsoleTest {
   public static void Main() {       
      Console.Write("Hello ");
      Console.WriteLine("World!");
      Console.Write("What is your name: ");
      string name = Console.ReadLine();
      Console.Write("Hello, ");
      Console.Write(name);
      Console.WriteLine("!");
   }
}
The output for a user who entered the name "Fred" is

Hello World!

What is your name: Fred

Hello, Fred!

See Also

System Namespace

Members

Console Methods

Console.OpenStandardError() Method
Console.OpenStandardError(int) Method
Console.OpenStandardInput() Method
Console.OpenStandardInput(int) Method
Console.OpenStandardOutput() Method
Console.OpenStandardOutput(int) Method
Console.Read Method
Console.ReadLine Method
Console.SetError Method
Console.SetIn Method
Console.SetOut Method
Console.Write(System.String, System.Object[]) Method
Console.Write(System.String, System.Object, System.Object, System.Object) Method
Console.Write(System.String, System.Object, System.Object) Method
Console.Write(System.String, System.Object) Method
Console.Write(bool) Method
Console.Write(char) Method
Console.Write(char[]) Method
Console.Write(char[], int, int) Method
Console.Write(double) Method
Console.Write(System.Decimal) Method
Console.Write(float) Method
Console.Write(int) Method
Console.Write(uint) Method
Console.Write(long) Method
Console.Write(ulong) Method
Console.Write(System.Object) Method
Console.Write(System.String) Method
Console.WriteLine(bool) Method
Console.WriteLine() Method
Console.WriteLine(System.String, System.Object[]) Method
Console.WriteLine(System.String, System.Object, System.Object, System.Object) Method
Console.WriteLine(System.String, System.Object, System.Object) Method
Console.WriteLine(System.String, System.Object) Method
Console.WriteLine(System.String) Method
Console.WriteLine(System.Object) Method
Console.WriteLine(ulong) Method
Console.WriteLine(long) Method
Console.WriteLine(uint) Method
Console.WriteLine(int) Method
Console.WriteLine(float) Method
Console.WriteLine(double) Method
Console.WriteLine(System.Decimal) Method
Console.WriteLine(char[], int, int) Method
Console.WriteLine(char[]) Method
Console.WriteLine(char) Method

Console Properties

Console.Error Property
Console.In Property
Console.Out Property


Console.OpenStandardError() Method

public static Stream OpenStandardError();

Summary

Returns the standard error stream.

Return Value

A new synchronized Stream object that writes to the console.

See Also

System.Console Class, System Namespace

Console.OpenStandardError(int) Method

public static Stream OpenStandardError(int bufferSize);

Summary

Returns the standard error stream.

Parameters

bufferSize
A Int32 that specifies the desired internal stream buffer size.

Return Value

A new synchronized Stream object that writes to the console.

Description

Buffering console streams is not required to be supported. If it is not supported, the bufferSize parameter is ignored, and this method behaves identically to System.Console.OpenStandardError(). If buffering is supported, the buffering behavior of the Console class is implementation-specific.

See Also

System.Console Class, System Namespace

Console.OpenStandardInput() Method

public static Stream OpenStandardInput();

Summary

Returns the standard input stream.

Return Value

A new synchronized Stream object that reads from the console.

See Also

System.Console Class, System Namespace

Console.OpenStandardInput(int) Method

public static Stream OpenStandardInput(int bufferSize);

Summary

Returns the standard input stream.

Parameters

bufferSize
A Int32 that specifies the desired internal stream buffer size.

Return Value

A new synchronized Stream object that reads from the console.

Description

Buffering console streams is not required to be supported. If it is not supported, the bufferSize parameter is ignored, and this method behaves identically to System.Console.OpenStandardInput(). If buffering is supported, the buffering behavior of the Console class is implementation-specific.

See Also

System.Console Class, System Namespace

Console.OpenStandardOutput() Method

public static Stream OpenStandardOutput();

Summary

Returns the standard output stream.

Return Value

A new synchronized Stream object that writes to the console.

See Also

System.Console Class, System Namespace

Console.OpenStandardOutput(int) Method

public static Stream OpenStandardOutput(int bufferSize);

Summary

Returns the standard output stream. The desired size of the internal buffer for the stream is specified.

Parameters

bufferSize
A Int32 that specifies the desired internal stream buffer size.

Return Value

A new synchronized Stream object that writes to the console.

Description

Buffering console streams is not required to be supported. If it is not supported, the bufferSize parameter is ignored, and this method behaves identically to System.Console.OpenStandardOutput(). If buffering is supported, the buffering behavior of the Console class is implementation-specific.

See Also

System.Console Class, System Namespace

Console.Read Method

public static int Read();

Summary

Reads the next character from the standard input stream.

Return Value

The next character from the character source represented as a Int32 , or -1 if at the end of the stream.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This method will not return until the read operation is terminated; for example, by the user pressing the enter key. If data is available, the input stream contains what the user entered, suffixed with the environment dependent newline character.

See Also

System.Console Class, System Namespace

Console.ReadLine Method

public static string ReadLine();

Summary

Reads the next line of characters from the System.Console.InTextReader.

Return Value

A String containing the next line from the input stream, or null if the end of the input stream has already been reached.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.
OutOfMemoryExceptionThere is insufficient memory to allocate a buffer for the returned string.

Description

A line is defined as a sequence of characters followed by a carriage return (Unicode 0x000d), a line feed (Unicode 0x000a), or a System.Environment.NewLine. The returned string does not contain the terminating character(s).

See Also

System.Console Class, System Namespace

Console.SetError Method

public static void SetError(TextWriter newError);

Summary

Sets the System.Console.Error property to the specified TextWriter .

Parameters

newError
A TextWriter that becomes the new standard error output stream.

Exceptions

Exception TypeCondition
SecurityExceptionThe caller does not have the required permission.
ArgumentNullExceptionnewError is null .

Description

This method replaces the System.Console.Error property with a synchronized TextWriter returned by System.IO.TextWriter.Synchronized(System.IO.TextWriter)( newError ).

[Note: By default, the System.Console.Error property is set to the system's standard error stream.]

See Also

System.Console Class, System Namespace

Console.SetIn Method

public static void SetIn(TextReader newIn);

Summary

Sets the System.Console.In property to the specified TextReader .

Parameters

newIn
A TextReader that becomes the new standard input stream.

Exceptions

Exception TypeCondition
ArgumentNullExceptionnewIn is null .

Description

This method replaces the System.Console.In property with a synchronized TextReader returned by System.IO.TextReader.Synchronized(System.IO.TextReader)( newIn ).

[Note: By default, the System.Console.In property is set to the system's standard input stream.]

See Also

System.Console Class, System Namespace

Console.SetOut Method

public static void SetOut(TextWriter newOut);

Summary

Sets the System.Console.Out property to the specified TextWriter .

Parameters

newOut
A TextWriter that becomes the new standard output stream.

Exceptions

Exception TypeCondition
ArgumentNullExceptionnewOut is null .

Description

This method replaces the System.Console.Out property with a synchronized TextWriter returned by System.IO.TextWriter.Synchronized(System.IO.TextWriter)( newOut ).

[Note: By default, the System.Console.Out property is set to the system's standard output stream.]

See Also

System.Console Class, System Namespace

Console.Write(System.String, System.Object[]) Method

public static void Write(string format, params object[] arg);

Summary

Writes a formatted string to the System.Console.OutTextWriter .

Parameters

format
A String that specifies the format string.
arg
An array of objects referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat or arg is null .

IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to arg.Length.

Description

[Note: If a specified object is not referenced in format, it is ignored.

For more information on format strings, see the String class overview.

]

See Also

System.Console Class, System Namespace

Console.Write(System.String, System.Object, System.Object, System.Object) Method

public static void Write(string format, object arg0, object arg1, object arg2);

Summary

Writes a formatted string to the System.Console.OutTextWriter .

Parameters

format
A String that specifies the format string.
arg0
The first object referenced in the format string.
arg1
The second object referenced in the format string.
arg2
The third object referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat is null .

IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to the number of provided objects to be formatted (3).

Description

[Note: If a specified object is not referenced in the format string, it is ignored.]

[Note: For more information on format strings see the String class overview.]

See Also

System.Console Class, System Namespace

Console.Write(System.String, System.Object, System.Object) Method

public static void Write(string format, object arg0, object arg1);

Summary

Writes a formatted string to the System.Console.OutTextWriter .

Parameters

format
A String that specifies the format string.
arg0
The first object referenced in the format string.
arg1
The second object referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat is null .
IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to the number of provided objects to be formatted (2).

Description

[Note: If a specified object is not referenced in format, it is ignored.

For more information on format strings, see the String class overview.

]

See Also

System.Console Class, System Namespace

Console.Write(System.String, System.Object) Method

public static void Write(string format, object arg0);

Summary

Writes a formatted string to the System.Console.OutTextWriter .

Parameters

format
A String that specifies the format string.
arg0
An object referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat is null .
IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to the number of provided objects to be formatted (1).

Description

[Note: If the specified object is not referenced in format, it is ignored.

For more information on format strings, see the String class overview.

]

See Also

System.Console Class, System Namespace

Console.Write(bool) Method

public static void Write(bool value);

Summary

Writes the text representation of a Boolean to the System.Console.OutTextWriter .

Parameters

value
The Boolean to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( value.ToString () ).

See Also

System.Console Class, System Namespace

Console.Write(char) Method

public static void Write(char value);

Summary

Writes a character to the System.Console.OutTextWriter .

Parameters

value
The Unicode character to write to the text stream.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

See Also

System.Console Class, System Namespace

Console.Write(char[]) Method

public static void Write(char[] buffer);

Summary

Writes a character array to the System.Console.OutTextWriter .

Parameters

buffer
The Unicode character array to write to the text stream. If buffer is null , nothing is written.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( buffer ).

See Also

System.Console Class, System Namespace

Console.Write(char[], int, int) Method

public static void Write(char[] buffer, int index, int count);

Summary

Writes a subarray of characters to the System.Console.OutTextWriter .

Parameters

buffer
The Unicode character array from which characters are read.
index
A Int32 that specifies the starting offset in buffer at which to begin reading.
count
A Int32 that specifies the number of characters to write.

Exceptions

Exception TypeCondition
ArgumentException(index + count ) is greater than the length of buffer.

IOExceptionAn I/O error occurred.
ArgumentOutOfRangeExceptionindex or count is negative.
ArgumentNullExceptionbuffer is null .

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( buffer, index, count ).

See Also

System.Console Class, System Namespace

Console.Write(double) Method

public static void Write(double value);

Summary

Writes the text representation of a specified Double to the System.Console.OutTextWriter .

Parameters

value
The Double to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write (value.ToString()).

Library

ExtendedNumerics

See Also

System.Console Class, System Namespace

Console.Write(System.Decimal) Method

public static void Write(decimal value);

Summary

Writes the text representation of a specified Decimal to the System.Console.OutTextWriter .

Parameters

value
The Decimal to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write (value.ToString()).

Library

ExtendedNumerics

See Also

System.Console Class, System Namespace

Console.Write(float) Method

public static void Write(float value);

Summary

Writes the text representation of a specified Single to the System.Console.OutTextWriter .

Parameters

value
The Single to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write (value .ToString()).

Library

ExtendedNumerics

See Also

System.Console Class, System Namespace

Console.Write(int) Method

public static void Write(int value);

Summary

Writes the text representation of a specified Int32 to the System.Console.OutTextWriter .

Parameters

value
The Int32 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( value.ToString()).

See Also

System.Console Class, System Namespace

Console.Write(uint) Method

public static void Write(uint value);

Summary

Writes the text representation of a specified UInt32 to the System.Console.OutTextWriter .

Parameters

value
The UInt32 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This member is not CLS-compliant. For a CLS-compliant alternative, use System.Console.Write(System.String,System.Object)(Int64).

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( value.ToString ()).

Attributes

CLSCompliantAttribute(false)

See Also

System.Console Class, System Namespace

Console.Write(long) Method

public static void Write(long value);

Summary

Writes the text representation of a specified Int64 to the System.Console.OutTextWriter .

Parameters

value
The Int64 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( value.ToString() ).

See Also

System.Console Class, System Namespace

Console.Write(ulong) Method

public static void Write(ulong value);

Summary

Writes the text representation of a specified UInt64 to the System.Console.OutTextWriter .

Parameters

value
The UInt64 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This member is not CLS-compliant. For a CLS-compliant alternative, use System.Console.Write(System.String,System.Object)(Decimal).

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( value .ToString()).

Attributes

CLSCompliantAttribute(false)

See Also

System.Console Class, System Namespace

Console.Write(System.Object) Method

public static void Write(object value);

Summary

Writes the text representation of a specified object to the System.Console.OutTextWriter .

Parameters

value
The object to write. If value is null , System.String.Empty is written.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( value.ToString () ).

[Note: If value is null , no exception is thrown and nothing is written. Otherwise, the object's System.Object.ToString method is called to produce the string representation, and the resulting string is written to the output stream.]

See Also

System.Console Class, System Namespace

Console.Write(System.String) Method

public static void Write(string value);

Summary

Writes a specified string to the System.Console.OutTextWriter .

Parameters

value
The String to write. If value is null , the System.String.Empty string is written.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.Write(System.String,System.Object) is equivalent to System.Console.Out.Write ( value ).

[Note: If specified value is null , nothing is written to the output stream.]

See Also

System.Console Class, System Namespace

Console.WriteLine(bool) Method

public static void WriteLine(bool value);

Summary

Writes the text representation of a Boolean followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The Boolean to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value.ToString() ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine() Method

public static void WriteLine();

Summary

Writes a line terminator to the System.Console.OutTextWriter .

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine(System.String, System.Object[]) Method

public static void WriteLine(string format, params object[] arg);

Summary

Writes a formatted string and a new line to the System.Console.OutTextWriter .

Parameters

format
A String that specifies the format string.
arg
An array of objects referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat or arg is null .

IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to arg.Length .

Description

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

[Note: If a specified object is not referenced in format, it is ignored.

For more information on format strings, see the String class overview.

]

See Also

System.Console Class, System Namespace

Console.WriteLine(System.String, System.Object, System.Object, System.Object) Method

public static void WriteLine(string format, object arg0, object arg1, object arg2);

Summary

Writes a formatted string and a new line to the System.Console.OutTextWriter .

Parameters

format
A String that specifies the format string.
arg0
The first object referenced in the format string.
arg1
The second object referenced in the format string.
arg2
The third object referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat is null .
IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to the number of provided objects to be formatted (3).

Description

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

[Note: If a specified object is not referenced in format, it is ignored.

For more information on format strings, see the String class overview.

]

See Also

System.Console Class, System Namespace

Console.WriteLine(System.String, System.Object, System.Object) Method

public static void WriteLine(string format, object arg0, object arg1);

Summary

Writes a formatted string and a new line to the System.Console.OutTextWriter .

Parameters

format
A String that specifies the format string.
arg0
The first object referenced in the format string.
arg1
The second object referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat is null .
IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to the number of provided objects to be formatted (2).

Description

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

[Note: If a specified object is not referenced in format, it is ignored.

For more information on format strings, see the String class overview.

]

See Also

System.Console Class, System Namespace

Console.WriteLine(System.String, System.Object) Method

public static void WriteLine(string format, object arg0);

Summary

Writes a formatted string and a line terminator to the System.Console.OutTextWriter.

Parameters

format
A String that specifies the format string.
arg0
An object referenced in the format string.

Exceptions

Exception TypeCondition
ArgumentNullExceptionformat is null .
IOExceptionAn I/O error occurred.
FormatExceptionThe format specification in format is invalid.

-or-

The number indicating an argument to be formatted is less than zero, or greater than or equal to the number of provided objects to be formatted (1).

Description

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

[Note: If the specified object is not referenced in format, it is ignored.

For more information on format strings, see the String class overview.

]

See Also

System.Console Class, System Namespace

Console.WriteLine(System.String) Method

public static void WriteLine(string value);

Summary

Writes a specified String followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The String to write. If value is null , only the line terminator is written.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine(System.Object) Method

public static void WriteLine(object value);

Summary

Writes the text representation of a specified object followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The object to write. If value is null , only the line terminator is written.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value.ToString() ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine(ulong) Method

public static void WriteLine(ulong value);

Summary

Writes the text representation of a specified UInt64 followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The UInt64 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This member is not CLS-compliant. For a CLS-compliant alternative, use System.Console.WriteLine(Decimal).

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value .ToString()).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

Attributes

CLSCompliantAttribute(false)

See Also

System.Console Class, System Namespace

Console.WriteLine(long) Method

public static void WriteLine(long value);

Summary

Writes the text representation of a specified Int64 followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The Int64 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value.ToString() ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine(uint) Method

public static void WriteLine(uint value);

Summary

Writes the text representation of a specified UInt32 followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The UInt32 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This member is not CLS-compliant. For a CLS-compliant alternative, use System.Console.WriteLine(Int64).

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value.ToString() ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

Attributes

CLSCompliantAttribute(false)

See Also

System.Console Class, System Namespace

Console.WriteLine(int) Method

public static void WriteLine(int value);

Summary

Writes the text representation of a specified Int32 followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The Int32 to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value .ToString ()).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine(float) Method

public static void WriteLine(float value);

Summary

Writes the text representation of a specified Single followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The Single to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine (value.ToString ()).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

Library

ExtendedNumerics

See Also

System.Console Class, System Namespace

Console.WriteLine(double) Method

public static void WriteLine(double value);

Summary

Writes the text representation of a specified Double followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The Double to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine (value.ToString ()).

The default line terminator is the value of theSystem.Environment.NewLine property. The line terminator can be set using theSystem.IO.TextWriter.NewLine property of the System.Console.Out stream.

Library

ExtendedNumerics

See Also

System.Console Class, System Namespace

Console.WriteLine(System.Decimal) Method

public static void WriteLine(decimal value);

Summary

Writes the text representation of a specified Decimal followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The Decimal to write.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine (value.ToString ()).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

Library

ExtendedNumerics

See Also

System.Console Class, System Namespace

Console.WriteLine(char[], int, int) Method

public static void WriteLine(char[] buffer, int index, int count);

Summary

Writes a subarray of characters followed by a line terminator to the System.Console.OutTextWriter .

Parameters

buffer
The Unicode character array from which data is read.
index
A Int32 that specifies the index into buffer at which to begin reading.
count
A Int32 that specifies the number of characters to write.

Exceptions

Exception TypeCondition
ArgumentException(index + count ) is greater than the length of buffer.

IOExceptionAn I/O error occurred.
ArgumentOutOfRangeExceptionindex or count is negative.
ArgumentNullExceptionbuffer is null .

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( buffer, index, count ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine(char[]) Method

public static void WriteLine(char[] buffer);

Summary

Writes an array of characters followed by a line terminator to the System.Console.OutTextWriter .

Parameters

buffer
The Unicode character array to write. If buffer is null , only the line terminator is written.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( buffer ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.WriteLine(char) Method

public static void WriteLine(char value);

Summary

Writes a character followed by a line terminator to the System.Console.OutTextWriter .

Parameters

value
The Unicode character to write to the text stream.

Exceptions

Exception TypeCondition
IOExceptionAn I/O error occurred.

Description

This version of System.Console.WriteLine is equivalent to System.Console.Out.WriteLine ( value ).

The default line terminator is the value of the System.Environment.NewLine property. The line terminator can be set using the System.IO.TextWriter.NewLine property of the System.Console.Out stream.

See Also

System.Console Class, System Namespace

Console.Error Property

public static TextWriter Error { get; }

Summary

Gets the system's standard error output stream.

Property Value

A synchronized TextWriter object where error output is sent.

Description

This property is read-only.

This property can be redirected using the System.Console.SetError(System.IO.TextWriter) method.

[Note: If the application does not have a Console, System.Console.Error behaves like System.IO.TextWriter.Null. ]

See Also

System.Console Class, System Namespace

Console.In Property

public static TextReader In { get; }

Summary

Gets the system's standard input stream.

Property Value

A synchronized TextReader object from which user input is received.

Description

This property is read-only.

This property can be redirected using the System.Console.SetIn(System.IO.TextReader) method.

[Note: If the application does not have a Console, System.Console.In behaves like System.IO.TextReader.Null. ]

See Also

System.Console Class, System Namespace

Console.Out Property

public static TextWriter Out { get; }

Summary

Gets the system's standard output stream.

Property Value

A synchronized TextWriter object where normal output is sent.

Description

This property is read-only.

This property can be redirected using the System.Console.SetOut(System.IO.TextWriter) method.

[Note: If the application does not have a Console, System.Console.Out behaves like System.IO.TextWriter.Null. ]

See Also

System.Console Class, System Namespace