Lets Learn C#

By Ashwin Venugopal

Let’s have a look at the below C# program.

// Namespace Declaration
using System;
class BinaryTitans
 public static void Main()
// Write to console
 Console.WriteLine ("Welcome to BinaryTitans and you are learning C# from Ashwin");

What is using System declaration?

The namespace declaration, using System, indicates that you are using the System namespace.

If  you decide not to write using System, declaration, then you have to use the fully qualified name of the Console class (You got to write System.Console.WriteLine).

A namespace is used to organize your code and is a collection of classes, interfaces, structs, enums and delegates.

What is Main() method?

Main method is the entry point into your application.

Happy Learning!

Comments (2)

  1. Sara says:

    Thanks for such a nice information, although I have one question – what is the line “using namespace std;” used for? I have used C# for quite a few years but never understood the concept. The main() is the main function, which includes all the main program of your C#.

    I even wrote an assignment for few of my clients here: http://www.writingjunction.com/assignments/

    1. using namespace std is used with a c++ header file, unlike c# it impacts not only that file, but every file that includes it.
      In C#, using directive only impacts the file or namespace scope where it is placed.

      Main(), its the entry point to the application.
      You can have methods written outside of the main(), and as long as you call those methods from main, it will execute.

      Hopefully, I cleared your doubts.

Skip to main content