What is Console Application:
A console application is an application that runs in a console window same as a C and C++ program.It doesn’t have any graphical user interface. Console Applications will have character based interface.To work with console applications in .NET you have to use a class called Console that is available within the namespace System, which is the root namespace.
Console Application in C#
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.
Example:
The below C#.NET code lets the user input a line of text and displays that textstring s = Console.ReadLine();
Console.WriteLine(s);
No comments:
Post a Comment