Thursday, April 21, 2011

Getting Started with C# (Sharp)

C# is simple modern, object-oriented, and type safe programing language derived from C and C++.
A class-based, single inheritance, procedural, programing language with a managed execution environment (offered by Microsoft.NET).
It also contains various new productivity features, like Intellisense code Snippets, Window forms designer updates and Exception assistant.

C# program

// Namespace Declaration
    using System;

    // Program start class
    class WelcomeCSS
    {
        // Main begins program execution.
        static void Main()
        {
            // Write to console
            Console.WriteLine("Welcome to the TechInfo!");
        }
    } 

The program  has 4 primary elements, a namespace declaration, a class, a Main method, and a program statement. It can be compiled with the following command line:

 csc.exe Welcome.cs

This produces a file named Welcome.exe, which can then be executed. Other programs can be compiled similarly by substituting their file name instead of Welcome.cs. For more help about command line options, type "csc -help" on the command line. The file name and the class name can be totally different.


Next





No comments:

Post a Comment