Open In App

Introduction to C#

Last Updated : 08 Oct, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

C# (C-sharp) is a modern, object-oriented language created by Microsoft in 2000 as part of the .NET framework. It is used to build Windows applications, web services and more. C# combines the power of C/C++ with the simplicity of Java and Visual Basic.

Why use C#?

  • Easy to learn: Clear, readable syntax, familiar to Java/C++ developers.
  • Object-Oriented: Supports OOP principles (encapsulation, inheritance, polymorphism).
  • Cross-platform: Build desktop, web, mobile, cloud and game applications.
  • Rich libraries & frameworks: Large .NET library for faster development.
  • Memory management: Automatic garbage collection reduces memory leaks.
  • Modern features: LINQ, async/await and other powerful tools.

Applications of C#

  • Windows Applications: Used to build desktop apps with frameworks like WPF and WinForms.
  • Web Applications & Services: Powers dynamic websites, APIs and services using ASP.NET / ASP.NET Core.
  • Game Development: Popular in Unity engine, one of the most widely used game development platforms.
  • Mobile Applications: Supports cross-platform apps with Xamarin and .NET MAUI.
  • Cloud & Enterprise Solutions: Widely used for scalable applications on Microsoft Azure and enterprise software.

Basic Program in C#

C#
using System;

namespace HelloGeeksApp{   
    class HelloGeeks{   
        static void Main(string[] args){
            Console.WriteLine("Hello Geek!");
            Console.ReadKey();
        }
    }
}

Output
Hello Geek!

Explanation

  1. Program starts execution from the Main method.
  2. Console.WriteLine("Hello Geek!"): prints "Hello Geek!" on the console.
  3. Console.ReadKey(): waits for the user to press a key so the console window doesn’t close immediately.

Keywords

  • using: lets you use classes from a namespace without full names.
  • System: built-in namespace that has basic classes (like Console).
  • namespace: groups related classes together (like a folder).
  • class: defines a class (container for code).
  • HelloGeeks: name of your class.
  • static: method belongs to the class itself, no object needed.
  • void: return type meaning “no value returned”.
  • string[] args: stores command-line arguments (optional input).

Frameworks and Technologies

C# works closely with the .NET ecosystem, which provides the runtime, libraries and tools for application development. Over time, several frameworks and technologies have evolved around C# to support diverse platforms.

6b41b46b-cc98-4102-a2b9-c4b5dfda6a0d
Frameworks and Technologies in C#

1. .NET Framework

  • The original Windows-only platform for building desktop and web applications.
  • Commonly used for WPF, WinForms and ASP.NET applications.

2. .NET Core

  • Cross-platform, open-source version of .NET.
  • Used to build apps that run on Windows, Linux and macOS.
  • Supports web APIs, microservices and command-line tools.

3. .NET 5 and Later (.NET Unified Platform)

  • Unifies .NET Framework and .NET Core into a single platform.
  • Provides performance improvements and cross-platform support for all application types.

4. ASP.NET and ASP.NET Core

  • Frameworks for developing dynamic web applications, RESTful APIs and MVC-based web services.

5. Entity Framework Core (EF Core)

  • Object-Relational Mapper (ORM) for database operations.
  • Allows developers to interact with databases using C# objects instead of SQL queries.

6. Unity Engine

  • A game development platform that uses C# scripts for game logic.
  • Powers 2D, 3D, AR and VR games across platforms like PC, consoles and mobile.

Advantages of C#

  • Automatic garbage collection: reduces memory leaks and makes memory management easy.
  • Safe and low maintenance: reliable compared to many other languages.
  • Cross-platform via IL: compiled into Intermediate Language, independent of OS/architecture.
  • Easy to learn: clear syntax, familiar to Java/C++ programmers.
  • Rich standard library: many built-in classes and features.
  • Strongly typed: reduces errors and improves reliability.

Related Articles


Article Tags :

Explore