C# Console WriteLine(String, Object, Object, Object, Object)
Description
Console WriteLine(String, Object, Object, Object, Object)
writes the text representation of the specified objects and variable-length
parameter list, followed by the current line terminator, to the standard
output stream using the specified format information.
Syntax
Console.WriteLine(String, Object, Object, Object, Object)
has the following syntax.
C# does not support methods that use variable length arguments (varargs).
The compiler automatically resolves calls to this method to the same method that uses a parameter array.
Parameters
Console.WriteLine(String, Object, Object, Object, Object)
has the following parameters.
format
- A composite format string (see Remarks).arg0
- The first object to write using format.arg1
- The second object to write using format.arg2
- The third object to write using format.arg3
- The fourth object to write using format.
Returns
Console.WriteLine(String, Object, Object, Object, Object)
method returns
Example
The following example illustrates the use of variable arguments with the WriteLine(String, Object, Object, Object, Object) method.
//from ww w. j a va 2 s. com
using System;
public class MainClass{
public static void Main(String[] argv){
Console.WriteLine("{0}{4}{1}{4}{2}{4}{3}", "aasdf", 1, 2, 3, Environment.NewLine);
}
}
The code above generates the following result.