C# (pronounced C-sharp) is a modern, object-oriented programming language developed by Microsoft. It is widely used to build Windows applications, web applications, mobile apps, games (using Unity), and enterprise software systems.
C# runs on the .NET runtime, which allows applications to execute on multiple platforms including Windows, macOS, and Linux with .NET Core and later versions of .NET. Its syntax is similar to other C-based languages like C++ and Java.
Hello World Program
using System;
class HelloWorldProgram
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
Output
Hello, World!
Basics
This section introduces the fundamental concepts of C#. It covers the core building blocks required to start writing C# programs, including variables, data types, and basic syntax.
- Introduction
- Identifiers
- Keywords
- Variables
- Data Types
- Constants and Literals
- Type Casting
- Comments
- Operators
Control Structures
Control structures define the flow of execution in a program. They allow decision-making, looping, and controlling statements and help in executing code conditionally or repeatedly.
- Decision Making: If-Else, Switch-Case
- Loops: For, While, Do-While
- Foreach Loop
- Jump Statements: Break, Continue
Functions
Functions are reusable blocks of code that perform a specific task. They help in organizing code into smaller and manageable parts. Its improve readability and reduce code duplication.
Arrays & Strings
Arrays are used to store multiple values of the same type. Strings represent sequences of characters used for text handling. They are fundamental for data storage and manipulation in programs.
- Introduction to Arrays
- Jagged Arrays
- Sorting an Array
- Introduction to String
- Verbatim String
- String vs StringBuilder
Object-Oriented Programming (OOP)
OOP is a programming paradigm based on objects and classes. It helps in organizing code using real-world concepts and improves code reusability, scalability, and maintainability.
- Class and Objects
- Methods
- Constructors & Destructors
- Properties
- Encapsulation
- Inheritance
- Polymorphism
- Abstraction
- Interface
Collections Framework
Collections are used to store and manage groups of objects dynamically. They provide flexible and efficient data handling compared to arrays. Common collections include lists, stacks, queues, and dictionaries.
- List
- ArrayList
- SortedList
- HashSet
- SortedSet
- Dictionary
- SortedDictionary
- Hashtable
- Stack
- Queue
- LinkedList
- BitArray Class
LINQ (Language Integrated Query)
LINQ is used to query and manipulate data in a simple way. It provides a SQL-like syntax inside C# for working with data. It improves code readability and reduces complex data operations.
Generics
Generics are used to improve code reusability and type safety. This section covers them.
Exception Handling
Exception handling is used to handle runtime errors in a program. It prevents program crashes and ensures smooth execution. It uses constructs like try, catch, and finally.
Multithreading
Multithreading allows multiple tasks to run simultaneously. It improves application performance and responsiveness. It is useful for parallel processing and background operations.
- Introduction
- Types of Threads
- Creating Threads
- Main Thread
- Lifecycle and States of Thread
- Thread Class
- Thread Priority
- Thread Synchronization
- Thread Safety & Race Conditions
- Joining Threads
- Terminating a Thread
.NET Framework
.NET Framework is the runtime environment for executing C# programs. It provides libraries and tools for building applications. It supports features like memory management and security.
- What is .NET Framework
- Common Language Runtime(CLR)
- IL (Intermediate Language)
- Managed and Unmanaged Code
Advanced C#
Advanced C# includes modern and powerful language features. It helps in writing efficient, flexible, and clean code. Topics include delegates, events and more.