Introduction to C# (original) (raw)

Last Updated : 22 Apr, 2026

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.

Basic C# Program

C# `

using System;

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

`

Structure of C# Program

The basic structure of a C# program defines the standard way every program must be written otherwise, it may result in errors or unexpected behavior during compilation or execution. The structure includes:

StructureofCSharpProgram

Structure of C# Program

  1. **Namespace Import: using System; imports the System namespace, which provides fundamental classes such as Console class provides methods for standard input and output operations (such as reading from and writing to the console).
  2. **Namespace Declaration: namespace HelloGeeksApp groups related classes together and helps organize code while avoiding naming conflicts.
  3. **Class Declaration: class HelloGeeks defines a class that acts as a container for methods and program logic.
  4. **Main Method: static void Main(string[] args) is the entry point of the C# program where execution begins. static means the method belongs to the class itself, and void indicates that it does not return any value.
  5. **Statement: Console.WriteLine("Hello Geek!"); prints the text "Hello Geek!" to the console using the WriteLine method of the Console class.
  6. **Braces { }: Curly braces define the beginning and end of code blocks such as namespaces, classes, and methods.

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#

Advantages