MSDN Documentation

Microsoft Developer Network

Introduction to C#

Welcome to the world of C#! This guide will introduce you to the fundamental concepts and syntax of the C# programming language, empowering you to start building powerful applications on the .NET platform.

What is C#?

C# (pronounced "C sharp") is a modern, object-oriented programming language developed by Microsoft. It's designed to be a simple, general-purpose, type-safe, and object-oriented language. C# is a versatile language used for developing a wide range of applications, including:

Key Features of C#

C# offers several compelling features that make it a popular choice for developers:

Your First C# Program: "Hello, World!"

Let's start with the traditional "Hello, World!" program. This simple program demonstrates the basic structure of a C# application.


using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello, World!");
    }
}
            

Explanation:

Tip: To run this code, you'll need to have the .NET SDK installed. You can save the code in a file named HelloWorld.cs, compile it using the command line (e.g., csc HelloWorld.cs), and then run the executable. Alternatively, you can use an IDE like Visual Studio or VS Code.

Next Steps

Congratulations on writing your first C# program! In the next tutorials, we'll dive deeper into essential C# concepts such as variables, data types, operators, and control flow structures. Keep exploring and happy coding!