aspdotnet_console.md - brainchildservices/curriculum GitHub Wiki
SLIDE-1
What is a Console Application
A console application, in the context of C#, is an application that takes input and displays output at a command line console with access to three basic data streams:
- standard input
- standard output
- standard error.
A console application facilitates the reading and writing of characters from a console - either individually or as an entire line. It is the simplest form of a C# program and is typically invoked from the Windows command prompt. A console application usually exists in the form of a stand-alone executable file with minimal or no graphical user interface (GUI).
SLIDE-2
What is the difference between console and Windows application?
Console applications are light weight programs run inside the command prompt (DOS) window. They are commonly used for test applications. Windows Applications are form based standard Windows desktop applications for common day to day tasks. Microsoft word is an example of a Windows application.
A console application is primarily designed for the following reasons:
- To provide a simple user interface for applications requiring little or no user interaction, such as samples for learning C# language features and command-line utility programs.
- Automated testing, which can reduce automation implementation resources.
SLIDE-3
Console Application in C#
To read a line of text from the console window, you use the Console.ReadLine() method. This will read an input stream from the console window and return the input string when user presses the Enter Key.
There are also two methods for writing to the console, which are used extensively
-
Console.Write() — Writes the specified value to the console window.
-
Console.WriteLine() — This does the same, but adds a newline character at the end of the output.
-
REF LINK: