C# Overview
Welcome to the C# documentation. C# (pronounced "C-sharp") is a modern, object-oriented, and type-safe programming language developed by Microsoft. It is designed for building a wide range of applications, from desktop and web services to mobile apps and cloud-based solutions.
C# runs on the .NET platform, which provides a comprehensive set of libraries and runtime services. This enables developers to create robust, high-performance applications that are cross-platform compatible.
Key Features of C#
- Object-Oriented: C# fully embraces object-oriented principles like encapsulation, inheritance, and polymorphism.
- Type-Safe: The language ensures that variables are of a specific type, reducing runtime errors.
- Modern and Evolving: C# is continuously updated with new features to enhance productivity and support modern development paradigms.
- Versatile: Suitable for developing various application types on the .NET ecosystem.
- Garbage Collection: Automatic memory management simplifies development and prevents memory leaks.
Getting Started with C#
To start your C# journey, you'll need the .NET SDK. You can download it from the official .NET download page.
Here's a simple "Hello, World!" program:
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
You can compile and run this code using the .NET CLI:
- Save the code in a file named
Program.cs
. - Open a terminal or command prompt in the same directory.
- Run the following commands:
dotnet new console -o MyFirstApp cd MyFirstApp // Replace the content of Program.cs with the code above dotnet run
Learn More
Explore the following sections to deepen your understanding of C#:
- C# Tour: A quick introduction to the language's core concepts.
- C# Language Reference: Detailed documentation for C# syntax and features.
- C# Programming Guide: Comprehensive guidance on how to use C# to build applications.
- C# Tutorials: Hands-on guides to learn C# by building real-world projects.