C # (C Sharp) basics

  • Like C, C++, C# is case-sensitive. 
  • Semi colon (;) is the statement separator. 
  • All code (class declaration and implementation) is placed in one file with extension cs.
  • Have a look at this Hello world program in C#.
  • using System;
    namespace MyNameSpace
    {
    
    class HelloWorld
    
    {
        static void Main(string[] args)
        {
            Console.WriteLine ("Hello World");
         }
    }
    
    }
    

  • Everything in C# is packed into a class and classes in C# are packed into namespaces (just like files in a folder). 
  • C#'s main function starts with name Main.
  • No need to put a semi colon after a class block or struct definition. 

0 comments :

Post a Comment

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger