Creating Console Applications
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Creating Console Applications (Visual C#) 

C# can be used to create applications that take input and display output at the command line console. These applications are ideal for learning C# development because the user interface is so simple. Console applications are also very useful for utility programs that require little or no user interaction.

To create a console application in Visual C#, click on New on the File menu and select Project. Click on the C# Console Application project template, provide the filenames that you want, and click OK.

Using the System.Console class

Use the Console class to read and write characters from the console, either individually or as an entire line. Output can be formatted in many different ways. For more information, see Formatting Overview.

Command-Line Arguments can be accessed using the optional string array associated with the Main method. For more information, see Command-Line Arguments (C# Programming Guide).


See Also

© 2016 Microsoft