We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Thursday, June 18, 2015

What is meaning of Console Application


  • A console application is an application that runs in a console window the same as a C and C++ program.
  • It doesn't have any graphical user interface. console Applications will have a character based interface.
  • To work with console applications in .NET we have to use a class called Console that is available within the namespace system, which is the root namespace.
  • The console is a class used to work with Input and Output streams.
  • Console class is present in System Namespace
A method in Console class:
For Displaying Output in the user Interface, we have mainly tow methods.

Write("Message")
This method is used to display a message to the user in the output stream. After displaying the message blinki8ng cursor remains in the same line.

Ex. Console.Write("Welcome");
O/P: Welcome

WriteLine("Message")
This method is used to display the required message to the user on the output stream. After displaying the message blinking cursor moves to a new line.
Ex: Console.WriteLine("Welcome");

O/P: Welcome

Note: Console.WritLine("Message";=Console.Write("Message\n");

For reading Input from the User Interface we have mainly two methods.

Read() 
Read method reads the  single character and converts that character into the ASCII value that means it returns the value of type integer;

ReadLine()
This will read an input stream from the console window and return the input string when the user presses the Enter key. And it converts any type of value to string type. We  mostly use ReadLine() instead of Read(). 

For clearing the screen we have only one method

Clear()
This method is used to delete the contents of the screen and is same as clrscr in C/C++

No comments: