Introduction to C# and .NET

A while back I was exposed to C# and .NET through my employer and being the learning guru that I am I decided to learn as much as I could about the topic. I figured it could only help me with my current job and maybe I could do something fun with it on the side. After a long break from blogging, I have decided to start posting more regularly. This post marks the beginning of a multi-post C# introduction and getting started tutorial.

What is C#

C# pronounced “C Sharp” is a programming language developed by Microsoft as a general purpose language. General purpose meaning that it can be used for a wide variety of solutions such as Windows applications, web applications, and even mobile apps. C# is not as fast regarding performance as other languages such as C++ or assembly nor is it meant to be. Developing C# applications is primarily done in Visual Studio by Microsoft on Windows, but there are ways it can be done on Mac or Linux with Mono.

What is .NET

The .NET framework is developed by Microsoft to run primarily on Windows. It is a framework for running software or rather a code execution environment that is composed of the CLR and FCL. The Common Language Runtime or CLR is what runs all applications that are written for the .NET framework. It does things such as memory management, thread execution, code execution, and compilation. The Framework Class Library or FCL is simply a collection of libraries that can be called when developing .NET applications.

What Can I Do With C#

As stated above C# is a general purpose programming language that can be used to develop many different types of applications. Some of these kinds of applications are:

  • Web Applications (ASP.NET) – Websites such as or
  • Windows Applications (WPF) – Applications such as Photoshop or Internet Explorer.
  • Windows Store Applications – These are applications that run on Windows 8 or later and downloaded from the Windows store.
  • Mobile Applications – Apps that run on Windows Phone, iOS, or Android.

Note: The above examples are just for helping with understanding. It does not mean that Facebook or Internet Explorer was developed with C# although it could certainly be possible.

Getting Started with C#

To get started writing applications using C# you will need to install Visual Studio on Windows. You can download Visual Studio 2015 Community Edition from the Visual Studio Website for free. The Community Edition is fully capable of getting you started with C# without having to purchase the Professional Edition.

If I am not on Windows?

If you are on a different operating system, then you will need to check out the Mono Project. This is beyond the scope of this article, but hopefully I will be writing about it very soon due to the fact I am a fan of all operating systems such as Linux or OSX. Also, there was recently a release of .NET Core, which is capable of running on other operating systems other than Windows, but I have not had a chance to check it out. I am super excited to check it out so hopefully I will be writing about that soon.

The Classic ‘Hello World’ Example

Once you download and install Visual Studio, you will be able to start developing applications with C#. To get you started, I am going to show you the classic ‘Hello World’ example. Follow the following steps.

  1. Open Visual Studio.
  2. You are now taken to the Start Page. Here you will click on New Project.
    Start Page - Microsoft Visual Studio
  3. Choose Console Application from Visual C# and give your project a name. In my case, I called it HelloWorld.
    New Project - Console Application - Microsoft Visual Studio
  4. Click Ok.
  5. You are taken to the Program.cs file where you can start writing your first C# application. Enter Console.WriteLine(“Hello World”); inside the Main method brackets.  This Main method is the entry point for all console applications in C#. Console.WriteLine just writes a string to the console window. When finished, your code should look like the code below.
    using System;
    namespace HelloWorld
        class Program
            static void Main(string[] args)
                Console.WriteLine("Hello World");
  6. Press Ctrl+F5 to run you application without debugging.
  7. You will see a console window open and display “Hello World” as shown below.
    Hello World - Windows Console Application

Congratulations! You just created your first C# application. This first application is a significant accomplishment, and many more great things are sure to come.

In this article, I told you about what C# is and its relationship to .NET. We also went over the classic “Hello World” example by creating a simple Windows console application that displays “Hello World”. This article is just one of many articles covering C#. If you have any questions or comments, please leave a comment below.