Introduction To C#


C# is a modern, object-oriented programming language developed by Microsoft in 2000 as part of the .NET framework initiative. It was designed to be simple, powerful, and versatile, making it a popular choice for building desktop applications, web applications, mobile apps, cloud-based services, and even games using the Unity engine.
Why Learn C#?
C# strikes a balance between performance, productivity, and readability. It is widely used in enterprise environments, game development, and modern cross-platform applications. With the support of .NET (including .NET Core and the latest .NET 9), C# runs on Windows, macOS, and Linux, giving developers flexibility and scalability.
Key Features of C#:
Object-Oriented – Supports classes, objects, inheritance, polymorphism, and encapsulation.
Strongly Typed – Variables must have a defined type, reducing runtime errors.
Cross-Platform – Works with .NET to run on different operating systems.
Rich Standard Library – Provides built-in functionality for file handling, networking, security, and more.
Memory Management – Automatic garbage collection reduces memory leaks.
Modern Features – Includes async/await, LINQ (Language Integrated Query), pattern matching, and lambda expressions.
Basic C# Syntax
C# code is organized into namespaces and classes. The entry point of every C# program is the Main method.
Example: A Simple "Hello, World!" Program
using System;
namespace HelloWorldApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}
Explanation:
using System; → Imports the System namespace, which contains basic classes like Console.
namespace HelloWorldApp → Defines a namespace to group related code.
class Program → Declares a class named Program.
static void Main(string[] args) → The program’s entry point.
Common Data Types in C
int → Represents integers (example: 42).
double → Represents floating-point numbers (example: 3.14).
char → Represents a single character (example: 'A').
string → Represents text (example: "Hello").
bool → Represents true/false values.
Example:
int age = 25;
string name = "Alice";
bool isStudent = true;
double score = 95.6;
Console.WriteLine("Name: " + name + ", Age: " + age + ", Score: " + score + ", Student: " + isStudent);
What Can You Build with C#?
Web Applications using ASP.NET Core
Mobile Apps with Xamarin or .NET MAUI
Desktop Apps with WPF or WinForms
Games with Unity Engine
Cloud Services on Microsoft Azure
APIs and Libraries for business and enterprise solutions
Subscribe to my newsletter
Read articles from Nourhan Ibrahim directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Nourhan Ibrahim
Nourhan Ibrahim
Full Stack Engineer | Product Designer Electronics Engineering Student Taekwondo Player🥋 https://linktr.ee/nouribram