C sharp Console Program

In my blog Csharp first Console Application was Hello CsharpTutorialsfree.blogspot.com the program  Csharp code is as follow
.

static void Main(string[] args)
{
  Console.WriteLine("Hello ! CsharpTutorialFree.blogspot.com");
  Console.ReadLine();

}
     Now we will see what did the above code for us and how did it works.
  1. The above line of code two things first they print a message on Console window (Black Screen).
  2. We have Console.ReadLine()  which tells the program to wait for the input from user.
we have a lot of text in first program like Console , WriteLine , ReadLine  etc what does all these really means we will understand this as we go deeper in our code that we just typed in .
As much the programming grows  this is the  main challenges for every programming languages that they must have better nouns ,verbs, Punctuation  from the existing ones.
Like other programming languages,when we learn how to write C sharp Applications we must have   familiar the dot.net Framework (.NET  FRAMEWORK). Now what the Dot.net Framework is ? we will learn in detail about the .Net Framework Later on but here we will just look at the Simple definition of Dotnet Framework which is "the .Net Framework is  a software which execute our Csharp code and runs our sharp applications".
As Programmer  we have  to look on every thing but the .Net Framework  make a lot of work easier for the Programmers  this helps the programmers   to don't worry about the low level details in  .Net framework  languages   like  allocating and De -allocating memory for the variables blah blah
Now the .NET Framework have the some basic library functions  as in our first program when we typed in Console.WriteLine("Hello Csharp");   we don't have to worry about memory management for our message  that how much memory  is need for our message to print   . we are just  have to think about what should be printed on screen we are not concern  how will our message will be  printed  on screen .when we look our code we have Console.WriteLine(); what does it Really do ? Answer is as follow.
In Console.WriteLine()  Console  Part is called Class. and the Write Line Part is called Method
We will learn in details about method and classes in our object Oriented part of C Sharp Programming.
All of the basic functionality is   in BCL (Base Class Library) of the .Net Framework.
this the console and write Line line is also a part of the .NET Framework Base Class Library.
the console bring a console window and the WriteLine Method Print our message that we have set through Parameters.

We use ReadLine()  Method of Console Class to pause our program  Until a User Press a key in there Keyboard.  if we  don't have ReadLine in our program  we will unable to see the our writeLine method though that method will be  correctly executed the console Window will close in mili seconds.
Note: When ever We want to print our message  on console window we should type our message in console class's WriteLine Method via Parameters.

Some method accepts Parameters and some of Don't Like ReadLine()  is a also a method in Console Class but they don't have parameter in our Program.

when we want to print our message we will have to pass our message through parameters. our message should be in (" "). what does the double quotes  (" ") do they tell the Csharp Compiler to just print that statement and its a lateral string (we will study about lateral strings and all data Type later on ).we can also print our message on console screen as follow.



static void Main(string[] args)
       {

              string Message  ="Hello ! CsharpTutorialsfree.blogspot.com";               
              Console.WriteLine(Message);
              Console.ReadLine();
       }


In above Program we just Store our message in a string called  Message and the we pass that string as parameter  to our Console class WriteLine Method .when we compile the out will be same for the as our first program.

No comments:

Post a Comment

Sending SMS Via Windows Form Application Using any Android Smart Phone  Source Code  using System ; using System . C...