Learn How to Start with C# in 10 Minutes

My First C# Program

C# had been a nightmare for me until I dared to write my first program and then it took five minutes to become my daymare. Yes, you will agree with me by the time you have finished reading this blog. So let's start.
  1. Install Visual Studio The very first thing you need to do is install Visual Studio 2015 in your system.You can easily download it from the link. Follow the instructions given and you are ready to go. This will take some time to download but surely it's going to be worth it.

  2. Create Console Application Go to File-->New-->Project-->Console Application. And name your project as "my first c sharp." You can choose whatever name you want. Make sure that you select the console application in Visual C#. And press OK.This will create a project for you.



  3. My First Program

    In the main function you have to write Console.WriteLine("BISMILLAH");. Main function is basically the entry gate of your code. Remember that C# is a case sensitive language and "WriteLine" and "writeline" are like elephant and aunt to C#. They are two opposite things you see ... I pretty much suck at examples. Press F5 and hey --  congratulations, you have made your first C# program.



    One thing you must have noted is that the console output screen just appears for a second and then disappears.To make the screen stay we will add a function named ReadLine() like this,



    And then your screen will not disappear.

  4. Some Basic Concepts

    "Using system" that you see in the first line of your code is basically the namespace. And namespace contains all classes and functions that will be used in a program. Namespace can contain other namespaces as well. For example try running the given code by removing "using system" and you will get an error because console.writeline is present in system namespace and couldn't work without it.
Ebook Download
View all
Learn
View all