13.8. Printing to the Screen, Revisited
As we saw in Chapter 1, we invoke one of two methods—Console.WriteLine() or Console.Write()—to print text messages to the command-line window as follows:
Console.WriteLine(expression to be printed); Console.Write(expression to be printed);
We glossed over the syntax of this particular operation when this capability was first introduced; now that you know much more about objects, let's revisit this syntax in more depth.
Console is a class provided by the CLR Base Class Library (part of the FCL) within the System namespace. The Console class defines numerous overloaded static Write and WriteLinemethods; the various versions each accept a different argument type: string, the various predefined value types, ...
Get Beginning C# 2008 Objects: From Concept to Code 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.