C# Language Fundamentals
Learn the basic syntax and structure of the C# programming language
60 min•By Priygop Team•Last updated: Feb 2026
What is C#?
C# (pronounced 'C Sharp') is a modern, object-oriented programming language developed by Microsoft. It's part of the .NET ecosystem and is widely used for building Windows applications, web applications, mobile apps, and cloud services.
C# Features and Benefits
- Type Safety: Prevents many common programming errors
- Memory Management: Automatic garbage collection
- Cross-Platform: Runs on Windows, Linux, and macOS
- Rich Library: Extensive .NET class library
- Modern Syntax: Clean, readable, and expressive
- Performance: Compiled to efficient machine code
- Integration: Works seamlessly with other .NET languages
Your First C# Program
Example
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Console.WriteLine("Welcome to C# Programming!");
// Get user input
Console.Write("Enter your name: ");
string name = Console.ReadLine();
Console.WriteLine($"Hello, {name}!");
}
}
}C# Syntax Basics
Example
// Comments in C#
// Single-line comment
/* Multi-line
comment */
// Namespace declaration
using System;
// Class declaration
public class MyClass
{
// Method declaration
public void MyMethod()
{
// Code goes here
}
}
// Variable declaration
int age = 25;
string name = "John";
bool isStudent = true;
// Console output
Console.WriteLine("Hello, World!");
Console.Write("Enter your name: ");
// Console input
string input = Console.ReadLine();