Variable index : Console Output « Development « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;


public class MainClass
{
    public static void Main()
    {
            int age = 25;
            string name = "Jim";
            Console.WriteLine(String.Format("{0} is {1} years old.", name, age));
    }

}
Jim is 25 years old.








14.3.Console Output
14.3.1.Console I/O
14.3.2.WriteLine
14.3.3.Write without new line
14.3.4.Substituting Values
14.3.5.Substituting Values twice
14.3.6.Write to Console.Out and Console.Error
14.3.7.Output an int to console
14.3.8.Concatenate string in Console.WriteLine
14.3.9.Format the same argument three different ways
14.3.10.Display arguments in non-sequential order
14.3.11.Variable index
14.3.12.Variable index: reference a variable more than once
14.3.13.Escape Characters: \\
14.3.14.Adds a total of 4 blank lines (then beep again!)
14.3.15.Displaying a Triangle Using a Verbatim String Literal
14.3.16.Use OpenStandardOutput method.