Sunday, 24 November 2013

CSHARP PROGRAMING BEGINNER GUIDELINE


C# programming is very easy so never be bored with this language. After sometime, when you will cover basic segment, you will be surely confident inC# programming.

Before staring complete C# tutorial, you must know the following guideline.

Guidline 1. Must check proper opening and closing of curly braces ({}).

Guidline 2. Your program should be properly nested.

Guidline 3. Press F5 to execute your program

Guidline 4. If you get exception, press Ctrl+F5 to stop execution.

Guidline 5. If you encounters infinite loop press Ctrl+C to break execution.

Guidline 6. After completion of each segment, must do exercise. It will help you clear your concept and improve your programming skills.

Guidline 7. Press F11 continuously to see how your program executes.


Using Notepad


Using Notepad

Using Visual Studio 2005 or 2008


Using Visual Studio

Using Notepad


Step 1: Open Notepad and write the following c# code carefully.


using System;
 
namespace Chapter1
{
  class Program
   {
     static void Main(string[] args)
      {
        Console.WriteLine("This is my First C# Program");
      }
   }
}


Step 2: Now save this program as Chapter1.cs. You must choose All Files in save as type box.
Step 3: Go to Start > All Programs > Microsoft Visual Studio 2005 or 2008 >Visual Studio Tools > Visual Studio 2005 or 2008 Command Prompt.
Step 4: Set Path in command prompt where your Chapter1.cs file is saved. Here we are using D:/Csharp>
Step 5: Now compile your program by following command:
  csc Chapter1.cs


You will see some information like compiler version number and framework information. There is no error, so you won’t get any error.
Step 6: Now, it’s turn to C sharp program. Just write your file name without extension and hit enter.
  Chapter1
Step 7: You will get the This is my First C# Program as output.

Output 

 

Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:\Program Files\MIcrosoft Visual Studio 9.0\VC>d:

D:\>cd csharp/

D:\csharp>csc Chapter1.cs
Microsoft <R> Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft <R> .NET Framework version 3.5
Copyright <C> Microsoft Corporation. All rights reserved.


D:\csharp>Chapter1
This is my First C# Program

D:\csharp>



Using Visual Studio 2005 or 2008


Visual Studio is easiest way to handle C# code. To execute the program onvisual studio, go through the following steps:
Step 1: Launch Visual Studio and go to File > New Project
Step 2: Select Visual C# in left pane and then choose Console Application.
Step 3: Select your location where you want to save the file and then click OK.
Step 4: Visual Studio will open a code editor window including some necessary code.
Step 5: Now write the above mentioned code and press Ctrl+F5 to run C# code.
Step 6: You will see the same output in Visual Studio Command Prompt.





No comments:

Post a Comment