Lesson 1
Last Updated : February, 2023
C# - Programming Language
This course covers the basics of programming in C#.

C# Overview

C# (pronounced “C sharp”) is a modern, object-oriented programming language developed by Microsoft as part of the .NET framework. It was first released in 2002 and is designed to be simple, powerful, and safe. C# is similar in syntax to other C-style languages, such as C++ and Java, but also includes some features that are unique to C#.

C# is often used to develop Windows desktop applications, web applications, games, and mobile apps. It is particularly popular for developing applications that run on the .NET platform, as it offers a wide range of features and tools for building complex applications with ease. Some notable features of C# include garbage collection, type safety, and support for multiple programming paradigms (such as imperative, functional, and object-oriented programming).

In recent years, Microsoft has been working on .NET Core, a cross-platform version of the .NET framework that allows developers to build applications for Windows, Linux, and macOS using C#. This has made C# an even more versatile and widely-used programming language, as it can now be used to build applications for a variety of platforms.

How C# Runs

C# is a compiled programming language, which means that the code you write in C# needs to be compiled into machine-readable code before it can be executed. Here is a brief overview of how C# code runs:

Writing Code: First, you write your C# code using a text editor or an integrated development environment (IDE) such as Visual Studio. C# code consists of classes, methods, and statements that define the behavior of your program.

Compilation: Once you have written your code, you use a C# compiler to translate it into an executable format that the computer can understand. The compiler takes your code and generates Intermediate Language (IL) code, which is a low-level language that can be executed by the .NET runtime.

Just-In-Time Compilation: When you run your C# program, the .NET runtime uses a Just-In-Time (JIT) compiler to translate the IL code into machine code that can be executed by the CPU. The JIT compiler optimizes the IL code for the specific hardware and operating system on which the program is running.

Execution: Finally, the machine code is executed by the CPU, and your C# program runs. As the program runs, it interacts with the operating system, the hardware, and other software components to accomplish its goals.

Throughout this process, the .NET runtime provides services such as memory management, exception handling, and security to ensure that your program runs smoothly and securely.

Choosing an IDE

Choosing an Integrated Development Environment (IDE) is an important decision when working with C#. The right IDE can improve your productivity, help you find and fix errors quickly, and provide you with useful features and tools to build your applications.

Here are some popular IDEs for C# development:

Visual Studio: This is Microsoft’s flagship IDE for developing .NET applications with C#. It provides a wide range of features and tools for developing desktop, web, and mobile applications. It has a powerful code editor with IntelliSense and code refactoring, debugging tools, unit testing, and version control integration.

JetBrains Rider: This is a cross-platform IDE that supports C# development on Windows, macOS, and Linux. It provides a comprehensive set of features for C# development, including code analysis, code completion, debugging, testing, and version control integration. It also supports other .NET languages such as VB.NET and F#.

Visual Studio Code: This is a lightweight, cross-platform IDE that can be extended with plugins for C# development. It provides a modern code editor with syntax highlighting, IntelliSense, and debugging tools. It also supports other programming languages and technologies such as JavaScript, HTML, CSS, and Git.

MonoDevelop: This is an open-source IDE for developing .NET applications on Linux, macOS, and Windows. It provides a code editor with IntelliSense, debugging tools, and support for multiple languages including C#, VB.NET, and F#. It also includes features for developing mobile applications with Xamarin.

When choosing an IDE, it’s important to consider your specific needs, such as the platform you’re developing for, the features you require, and your budget. You may also want to try out different IDEs before settling on one that works best for you.