Input/Output Operations in C#

The System namespace contains a Console class that includes methods that are essential for reading from and writing to the screen. They are

Console.WriteLine()

The Console.WriteLine method is used to write output to the screen. It can be used for all types of data. The program shown in Listing 4.4 demonstrates the various ways in which this method can be used.

Listing 4.4. The Console.WriteLine() Method
using System; 
class UseWrite 
{
          public static void Main() 
          {
              Console.WriteLine(“Console is a class in the System namespace”); 
              string str1=”Console”; 
              string str2=”System”; 
              Console.WriteLine(“{0} is a class in the {1} namespace”,str1,str2); 
          } 
}

The first Console.Writeline() ...

Get Special Edition Using C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.