How To Program in C Sharp
If you are beginner for C Sharp and want to learn how to create my first program by this programming language then this procedure will creates a C# version of the traditional ” This is my first program!” program. The program will display this string “This is my first program!”
1. First of all start the Visual Studio.
2. On the menu bar:
choose File>> New>> Project.
You will see that a New Project dialog box will open.
3. Expand Installed>> Expand Templates>> Expand Visual C#, and after that choose Console Application.
4. Specify a name for your project in the Name box and choose the OK button.
You will see that a New Project appears in Solution Explorer.
5. If Program.cs isn’t open in the Code Editor, open the shortcut menu for Program.cs in Solution Explorer, and after that choose View Code.
6. Replace the contents of Program.cs with the following code.
// This is my first program! program in C#.
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine(“This is my first program!”);
// Please keep the console window open in debug mode.
Console.WriteLine(“Press any key to exit.”);
Console.ReadKey();
}
}
}
7. Press F5 key to run the project. A Command Prompt window appears that contains the line This is my first program!!
Leave a Reply