Introduction to C#

What is C# and why to use C#.

C# (csharp) is a general purpose, object oriented, powerful programming language developed by Microsoft. A Team of developers led by Anders Hejlsberg at Microsoft developed this language and it is approved by European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO). Using C#, developers can build many types of secured and robust applications with .NET framework

C# has it's roots in C and C++. The developers who have worked on C or C++ shall find the C# quite familiar. Since it's creation , C# has added many features which plays important role in developing quality softwares and applications. With each version of the C#, new features were added to support the modern software development approach.

A brief about .Net framework.

A .Net framework is a virtual machine known as Common Language Runtime with the set of libraries.
.Net framework compiles and executes programs written in language like C# and Visual basic. .Net framework contains many libraries to support workload and development of different types of applications. These libraries are organized into namespaces. When C# has perform certain operation, the required namespace must be imported from .Net framework.

A simple C# program
using System;
 
namespace HelloCsharp
{
    public class Program
    {
        static void Main()
        {
            Console.WriteLine("Hello cSharp");
        }
    }
}

Explanation:

using System: This statement specifies that the program is importing the System namespace and it's functionalities that are required by program to run.

namespace HelloCsharp:  This is the user defined custom namespace. It can be thought of as container for all your classes and libraries.

public class Program:  As C# is object oriented language, the members and functions are written inside  a class. 

static void main(): This is the entry point of the application. When the C# application is run, the main() method will be executed first.

Console.WriteLine("Hello Csharp"): This statement writes the Hello Csharp on the console window.

How to C# program is executed?

  • The source code is compiled into Intermediate Language (IL). The IL code along with resources is stored into an assembly with the .dll extension. 
  • When the C# program is executed, the dll assembly is loaded into CLR. The CLR converts IL code to native machine instructions using Just-In-time compilation. CLR provides many service some of which are automatic garbage collection, error handling resource management etc

Features of C#

  • Type safety
  •  Auto Implemented properties
  • Anonymous methods
  • Lambda expression
  • Expression trees
  • Extension methods
  • Implicitly typed local variables
  • Partial Classes and methods  and many more

Why to use C#

  • C# is easy to learn language, simple object oriented language.
  • C# is modern object oriented language which supports development of many types of robust and secured applications.
  • Because of it's popularity, it has wide community of developers.
  • Variety of applications can be developed with C# including Console application, Windows form, WPF, WCF services, class libraries web applications etc.
  • C# is the preferred language for Game development.
  • Highly scalable applications can be developed.

Summary

There is a high demand of C# developers in the market. Since it's creation, Microsoft has been adding many new features to the C#. Many companies in the world use C# language along with .Net framework to develop their softwares and applications.

The latest version of the C# is C# 11. The popularity of the C# is continuously growing. It's definitely  worth learning C# to make career as Software developer.



Click here to watch the video tutorial.

Comments

Popular posts from this blog

Implicitly typed keyword - var in C#

Classes and objects in C#

Data types in C#