Udostępnij za pośrednictwem


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).

Example

See Also

Other Resources

Writing Applications with Visual C#