First Step:- Simple C#

The best way to learn a new programming language  to write a few simple programs and execute them.
A C# program basically consists of the following parts:
 Namespace declaration
 A class
 Class methods
 Class attributes
 A Main method
 Statements & Expressions
 Comments
Lets start:-

using System;  // System is a namespace
class Simple   //Declaration of a class. Simple is as a C# <em>identifier</em>
{
public static void Main()
{
//Main method begins
Console.WriteLine("Welcome to C# world..!!");
Console.ReadKey();
}
// main methods ends
}

C# supports a feature known as Using directives that can be used to import System namespace into the program.

How to Compile & Execute a C# Program:
If you are using Visual Studio.Net for compiling and executing C# programs, take the following steps:
 Start Visual Studio.
 On the menu bar, choose File, New, Project.
 Choose Visual C# from templates, and then choose Windows.
 Choose Console Application.
 Specify a name for your project, and then choose the OK button.
 The new project appears in Solution Explorer.
 Write code in the Code Editor.
 Click the Run button or the F5 key to run the project.
A Command Prompt window appears that contains the line Welcome to C# world..!!

When the above code is compiled and executed, it produces the following result:-
simple c#

Leave a comment