Console.WriteLine Method
Writes the specified data, followed by the current line terminator, to the standard output stream.
Overload List
Writes the current line terminator to the standard output stream.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine()
[C#] public static void WriteLine();
[C++] public: static void WriteLine();
[JScript] public static function WriteLine();
Writes the text representation of the specified Boolean value, followed by the current line terminator, to the standard output stream.
[Visual Basic] Overloads Public Shared Sub WriteLine(Boolean)
[C#] public static void WriteLine(bool);
[C++] public: static void WriteLine(bool);
[JScript] public static function WriteLine(Boolean);
Writes the specified Unicode character, followed by the current line terminator, value to the standard output stream.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(Char)
[C#] public static void WriteLine(char);
[C++] public: static void WriteLine(__wchar_t);
[JScript] public static function WriteLine(Char);
Writes the specified array of Unicode characters, followed by the current line terminator, to the standard output stream.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(Char())
[C#] public static void WriteLine(char[]);
[C++] public: static void WriteLine(__wchar_t __gc[]);
[JScript] public static function WriteLine(Char[]);
Writes the text representation of the specified Decimal value, followed by the current line terminator, to the standard output stream.
[Visual Basic] Overloads Public Shared Sub WriteLine(Decimal)
[C#] public static void WriteLine(decimal);
[C++] public: static void WriteLine(Decimal);
[JScript] public static function WriteLine(Decimal);
Writes the text representation of the specified double-precision floating-point value, followed by the current line terminator, to the standard output stream.
[Visual Basic] Overloads Public Shared Sub WriteLine(Double)
[C#] public static void WriteLine(double);
[C++] public: static void WriteLine(double);
[JScript] public static function WriteLine(double);
Writes the text representation of the specified 32-bit signed integer value, followed by the current line terminator, to the standard output stream.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(Integer)
[C#] public static void WriteLine(int);
[C++] public: static void WriteLine(int);
[JScript] public static function WriteLine(int);
Writes the text representation of the specified 64-bit signed integer value, followed by the current line terminator, to the standard output stream.
[Visual Basic] Overloads Public Shared Sub WriteLine(Long)
[C#] public static void WriteLine(long);
[C++] public: static void WriteLine(__int64);
[JScript] public static function WriteLine(long);
Writes the text representation of the specified object, followed by the current line terminator, to the standard output stream.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(Object)
[C#] public static void WriteLine(object);
[C++] public: static void WriteLine(Object*);
[JScript] public static function WriteLine(Object);
Writes the text representation of the specified single-precision floating-point value, followed by the current line terminator, to the standard output stream.
[Visual Basic] Overloads Public Shared Sub WriteLine(Single)
[C#] public static void WriteLine(float);
[C++] public: static void WriteLine(float);
[JScript] public static function WriteLine(float);
Writes the specified string value, followed by the current line terminator, to the standard output stream.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(String)
[C#] public static void WriteLine(string);
[C++] public: static void WriteLine(String*);
[JScript] public static function WriteLine(String);
Writes the text representation of the specified 32-bit unsigned integer value, followed by the current line terminator, to the standard output stream. This method is not CLS-compliant.
[Visual Basic] Overloads Public Shared Sub WriteLine(UInt32)
[C#] public static void WriteLine(uint);
[C++] public: static void WriteLine(unsigned int);
[JScript] public static function WriteLine(UInt32);
Writes the text representation of the specified 64-bit unsigned integer value, followed by the current line terminator, to the standard output stream. This method is not CLS-compliant.
[Visual Basic] Overloads Public Shared Sub WriteLine(UInt64)
[C#] public static void WriteLine(ulong);
[C++] public: static void WriteLine(unsigned __int64);
[JScript] public static function WriteLine(UInt64);
Writes the specified object, followed by the current line terminator, to the standard output stream using the specified format information.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(String, Object)
[C#] public static void WriteLine(string, object);
[C++] public: static void WriteLine(String*, Object*);
[JScript] public static function WriteLine(String, Object);
Writes the specified array of objects, followed by the current line terminator, to the standard output stream using the specified format information.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(String, ParamArray Object())
[C#] public static void WriteLine(string, params object[]);
[C++] public: static void WriteLine(String*, Object[]);
[JScript] public static function WriteLine(String, Object[]);
Writes the specified subarray of Unicode characters, followed by the current line terminator, to the standard output stream.
[Visual Basic] Overloads Public Shared Sub WriteLine(Char(), Integer, Integer)
[C#] public static void WriteLine(char[], int, int);
[C++] public: static void WriteLine(__wchar_t __gc[], int, int);
[JScript] public static function WriteLine(Char[], int, int);
Writes the specified objects, followed by the current line terminator, to the standard output stream using the specified format information.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(String, Object, Object)
[C#] public static void WriteLine(string, object, object);
[C++] public: static void WriteLine(String*, Object*, Object*);
[JScript] public static function WriteLine(String, Object, Object);
Writes the specified objects, followed by the current line terminator, to the standard output stream using the specified format information.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Sub WriteLine(String, Object, Object, Object)
[C#] public static void WriteLine(string, object, object, object);
[C++] public: static void WriteLine(String*, Object*, Object*, Object*);
[JScript] public static function WriteLine(String, Object, Object, Object);
[C++] Writes the specified objects and variable length parameter list, followed by the current line terminator, to the standard output stream using the specified format information. This method is not CLS-compliant.
[C++] public: static void WriteLine(String*, Object*, Object*, Object*, Object*, ...);
Example
The following code sample illustrates the use of WriteLine:
[Visual Basic] Public Class TipCalculator Private Const tipRate As Double = 0.18 'Entry point which delegates to C-style main Private Function Public Overloads Shared Sub Main() System.Environment.ExitCode = Main(System.Environment.GetCommandLineArgs()) End Sub Overloads Public Shared Function Main(args() As String) As Integer Dim billTotal As Double If args.Length < 2 Then Console.WriteLine("usage: TIPCALC total") Return 1 Else Try billTotal = Double.Parse(args(1)) Catch Console.WriteLine("usage: TIPCALC total") Return 1 End Try Dim tip As Double = billTotal * tipRate Console.WriteLine() Console.WriteLine("Bill total:" + ControlChars.Tab + "{0,8:c}", billTotal) Console.WriteLine("Tip total/rate:" + ControlChars.Tab + "{0,8:c} ({1:p1})", tip, tipRate) Console.WriteLine("".PadRight(24, "-"c)) Console.WriteLine("Grand total:" + ControlChars.Tab + "{0,8:c}", billTotal + tip) Return 0 End If End Function 'Main End Class 'TipCalculator [C#] public class TipCalculator { private const double tipRate = 0.18; public static int Main(string[] args) { double billTotal; if (args.Length == 0) { Console.WriteLine("usage: TIPCALC total"); return 1; } else { try { billTotal = Double.Parse(args[0]); } catch(FormatException) { Console.WriteLine("usage: TIPCALC total"); return 1; } double tip = billTotal * tipRate; Console.WriteLine(); Console.WriteLine("Bill total:\t{0,8:c}", billTotal); Console.WriteLine("Tip total/rate:\t{0,8:c} ({1:p1})", tip, tipRate); Console.WriteLine(("").PadRight(24, '-')); Console.WriteLine("Grand total:\t{0,8:c}", billTotal + tip); return 0; } } } [C++] int main() { String* args[] = Environment::GetCommandLineArgs(); const double tipRate = 0.18; double billTotal; if (args->Length != 2) { Console::WriteLine(S"usage: TIPCALC total"); return 1; } else { try { billTotal = Double::Parse(args[1]); } catch(FormatException*) { Console::WriteLine(S"usage: TIPCALC total"); return 1; } double tip = billTotal * tipRate; Console::WriteLine(); Console::WriteLine(S"Bill total:\t{0,8:c}", __box(billTotal)); Console::WriteLine(S"Tip total/rate:\t{0,8:c} ({1:p1})", __box(tip), __box(tipRate)); Console::WriteLine((S"")->PadRight(24, '-')); Console::WriteLine(S"Grand total:\t{0,8:c}", __box(billTotal + tip)); return 0; } } [JScript] const tipRate : Number = 0.18; var billTotal : Number; var args : String[] = Environment.GetCommandLineArgs(); if (args.Length != 2) { Console.WriteLine("usage: TIPCALC total"); Environment.Exit(1); } try { billTotal = Double.Parse(args[1]); } catch(FormatException) { Console.WriteLine("usage: TIPCALC total"); Environment.Exit(1); } var tip : double = billTotal * tipRate; Console.WriteLine(); Console.WriteLine("Bill total:\t{0,8:c}", billTotal); Console.WriteLine("Tip total/rate:\t{0,8:c} ({1:p1})", tip, tipRate); Console.WriteLine(("").PadRight(24, '-')); Console.WriteLine("Grand total:\t{0,8:c}", billTotal + tip);