0% found this document useful (0 votes)
545 views11 pages

C# Tutorial - GeeksforGeeks_241215_204941

The C# tutorial provides a comprehensive overview of the C# programming language, its applications, and features, including object-oriented programming concepts and various data structures. It covers topics from basic syntax and environment setup to advanced concepts like multithreading and exception handling. The tutorial is designed for all levels, offering a structured approach to learning C# within the .NET framework.

Uploaded by

Ercivan Gokmen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
545 views11 pages

C# Tutorial - GeeksforGeeks_241215_204941

The C# tutorial provides a comprehensive overview of the C# programming language, its applications, and features, including object-oriented programming concepts and various data structures. It covers topics from basic syntax and environment setup to advanced concepts like multithreading and exception handling. The tutorial is designed for all levels, offering a structured approach to learning C# within the .NET framework.

Uploaded by

Ercivan Gokmen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

C# Tutorial

Last Updated : 13 Dec, 2024

C# (pronounced "C-sharp") is a modern, versatile, object-oriented


programming language developed by Microsoft in 2000 that runs on the
.NET Framework. Whether you're creating Windows applications, diving into
Unity game development, or working on enterprise solutions, C# is one of
the top choices for developers worldwide.

C# originates from the C programming family and shares similarities with


other widely-used languages like C++ and Java.
Mainly used to develop the desktop apps, windows apps, games(with
unity engine), mobile apps and web services etc.
C# is the primary language for developing games using the Unity engine.
With .NET Core, C# applications can run on Windows, macOS, and Linux.
The latest version, C# 13 was released in November 2024 alongside .NET
9.

Hello World Program


C#

1 // C# Hello World Program


2 using System;
3
4 class HelloWorldProgram {
5
6 // Main Method
7 static void Main(string[] args)
8 {
9
10 // "printing Hello World"
11 Console.WriteLine("Hello, World!");
12 }
13 }

We use cookies to ensure you have the best browsing experience on our website. By
using our site, you acknowledge that you have read and understood our Cookie Policy & Got It !
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.

Output

Hello, World!

This C# tutorial covers everything from beginners to advanced level. We’ll


start with the basics like setting up your environment, C# syntax, and
writing "Hello World" program, data types, and loops etc. After that we will
start with advanced topics like object-oriented programming, delegates,
tuples, indexers, collections, multithreading, and LINQ etc.

.NET Framework Overview


What is .NET Framework?
.NET Framework Architecture
Managed and Unmanaged Code
CIL or MSIL
Common Language Runtime(CLR)

Introduction
What is C#?
Installing and Setup Visual Studio Code
Setting Up Enviornment Variables
Hello World Program
Excecuting Program on CMD

Basics
Identifiers
Variables
Data Types
Constants and Literals
Scope of Variables
Params
Type Casting
Comments
Operators

We use cookies to ensure you have the best browsing experience on our website. By
Control Structures
using our site, you acknowledge that you have read and understood our Cookie Policy &
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
Decision Making: If-Else, Switch-Case
Switch Statement
Loops: For, While, Do-While
Foreach Loop
Jump Statements: Break, Continue, Goto

Arrays & Strings


Introduction to Arrays
Jagged Arrays
Sorting an Array
Introduction to String
Verbatim String Literal – @
StringBuilder in C#
String vs StringBuilder

OOPS Concepts
Class and Objects
Methods
Constructors
Destructors
Properties
Access Modifiers
Abstraction
Encapsulation
Inheritance
Method Overloading
Method Overriding
Abstract Classes
Interface
Sealed Classes

Delegates
Delegates
Predicate Delegate
Action Delegate
Func Delegate

Tuple
We use cookies to ensure you have the best browsing experience on our website. By
using our site, you acknowledge that you have read and understood our Cookie Policy &
What is Tuple?
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
Tuple Class
Tuple<T1> Class
Tuple<T1,T2> Class
Tuple<T1,T2,T3> Class
Tuple<T1,T2,T3,T4> Class
Tuple<T1,T2,T3,T4,T5> Class
Tuple<T1,T2,T3,T4,T5,T6> Class
Tuple<T1,T2,T3,T4,T5,T6,T7> Class
Tuple<T1,T2,T3,T4,T5,T6,T7,TRest> Class

ValueTuple
What is ValueTuple?
ValueTuple Struct
ValueTuple <T1> Struct
ValueTuple <T1,T2> Struct
ValueTuple <T1,T2,T3> Struct
ValueTuple <T1,T2,T3,T4> Struct
ValueTuple <T1,T2,T3,T4,T5> Struct
ValueTuple <T1,T2,T3,T4,T5,T6> Struct
ValueTuple <T1,T2,T3,T4,T5,T6,T7> Struct
ValueTuple <T1,T2,T3,T4,T5,T6,T7,TRest> Struct

Indexers & Properties


Indexers
Multidimensional Indexers
Overloading of Indexers
Properties
Restrictions on Properties

Multithreading
Introduction to Multithreading
Types of Threads
Creating Threads
Main Thread
Lifecycle and States of a Thread
Thread Class
Scheduling
We use cookies to ensure a thread
you have thefor Execution
best browsing experience on our website. By
using our site, you acknowledge that you have read and understood our Cookie Policy &
Check whether a Thread is Alive or Not
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
Joining Threads
Terminating a Thread
Thread Priority in Multithreading

Exception Handling
Exceptions
System Level Exception vs Application Level Exception
How to Use Multiple Catch Clause
Nesting of Try and Catch Blocks
Using Finally

Collections & Generics


List
SortedList with Examples
HashSet
SortedSet
Dictionary with Examples
SortedDictionary
Hashtable with Examples
Stack with Examples
Queue with Examples
LinkedList
Hashtable vs Dictionary
SortedList vs SortedDictionary

Collections Namespace
Stack Class
Queue Class
Array Class
ArrayList Class
Hashtable Class
BitArray Class
SortedList Class

Generic Namespace
HashSet<T> Class
We use cookies to ensure you Class
LinkedList<T> have the best browsing experience on our website. By
using our site, you acknowledge that you have read and understood our Cookie Policy &
List<T> Class
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
SortedSet<T> Class
Dictionary Class
SortedDictionary Class

System Namespace
BitConverter Class
Console Class
Convert Class
Decimal Struct
Byte Struct
Char Struct
Int16 Struct
Int32 Struct
Int64 Struct
UInt16 Struct
UInt32 Struct
UInt64 Struct

Specialized Namespace
ListDictionary Class
StringCollection Class
OrderedDictionary Class
HybridDictionary Class
StringDictionary Class

C# 8.0
Static Local Function
Range and Indices
Range Structure
Index Struct

Windows Forms
What is Windows Forms(WF)?
Button Control
Label Control
RadioButton Control
We use cookies to ensure
CheckBox you have the best browsing experience on our website. By
Control
using our site, you acknowledge that you have read and understood our Cookie Policy &
TextBox Control
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
ComboBox Control
ToolTip Class
RichTextBox Class
MaskedBox Class
NumericUpDown Class
DateTimePicker Class
ListBox Class
GroupBox Class
FlowLayoutPanel Class

C# Features
Simple: C# is a user-friendly language that offers a structured approach to
problem-solving. it provides a wide range of library functions and data
types to work.
ModernC#
.NET Framework Programming
Data Types C#Language:
Keywords C# programming
C# Decision Making isC#
a Methods
popular and
C# Delegates C# Co
powerful language that is for creating scalable, interoperable, and robust
applications.
Object Oriented: C# is an object-oriented programming language, which
makes development and maintenance easier. In contrast, with procedure-
oriented programming languages, managing code becomes difficult as
project size grows.
Type Safe: The code is type safe can only access memory locations that it
has permission to execute. This feature significantly enhances program
security.
Interoperability: The interoperability process allows C# programs to
perform all the tasks that a native C++ application.
Scalable and Updateable: C# is a programming language that is scalable
and can be updated automatically. To update our application, we remove
the old files and replace them with new ones.
Component Oriented: It is widely used as a software development
methodology to create applications that are more strong and can easily
scale.
Structured Programming Language: C# is a structured programming
language that allows us to divide programs into parts using functions,
making it easy to understand and modify.
Fast Speed: The compilation and execution time of C# language is fast.

We use cookies to ensure you have the best browsing experience on our website. By
FAQs
using our site, you acknowledge that you have read and understood our Cookie Policy &
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
1. What is C# programming language used for?

C# is a versatile programming language primarily used for developing


Windows applications, web services, and games within the .NET
framework.

2. What is the advantage of ‘using’ statement in C#?

The ‘using’ statement provides resources for processing before


automatically disposing of it when execution is completed.

3. What is serialization?

To transport an object through a network, we need to convert it into a


stream of bytes. It is called Serialization.

4. What are the four steps involved in the C# code compilation?

4 steps of code compilation in C# include:


Source code compilation in managed code.
Newly created code is merged with assembly code.
The Common Language Runtime (CLR) is loaded.
Assembly execution is done through CLR.

5. How can I declare and initialize variables in C#?

Variables are named containers that store values of different types. To


declare a variable in C#, you need to specify its type and name.

C# and .NET Professionals, Your Dream Job Awaits!

Hubstream India is looking for YOU— A skilled developers with 2-5 years of
experience in Microsoft technologies—to join their exclusive Job-A-Thon
hiring challenge.

This is your chance to work with a world-class team tackling real-world


issues like Cybercrime and Brand Protection while enjoying a package of up
We use cookies to ensure you have the best browsing experience on our website. By
tosite,
using our ₹12 youLPA. Apply that
acknowledge Now!you have read and understood our Cookie Policy &
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
Comment More info Next Article
Introduction to .NET Framework

Similar Reads

Introduction

C# Tutorial

C# is the most common programming language used to develop multiple applications in the.NET
framework, and it was introduced by Microsoft in 2000. It was designed to be a simple, object-oriented…

7 min read

Introduction to .NET Framework

The .NET Framework is a software development framework developed by Microsoft that provides a
runtime environment and a set of libraries and tools for building and running applications on Windows…

7 min read

C# | .NET Framework (Basic Architecture and Component Stack)

Microsoft created the language C#, known as C Sharp, in the year 2000. C# is an object-oriented
programming language that is used in .NET Framework. C# is designed to be simple, efficient, and…

6 min read

Hello World in C#

The Hello World! program is the most basic and first program when you dive into a new programming
language. This simply prints the Hello World! on the output screen. In C#, a basic program consists of th…

3 min read

Common Language Runtime (CLR) in C#

The Common Language Runtime (CLR) is a component of the Microsoft .NET Framework that manages the
execution of .NET applications. It is responsible for loading and executing the code written in various .NE…

6 min read

Fundamentals

Control Statements
We use cookies to ensure you have the best browsing experience on our website. By
usingOOP
our site, you acknowledge that you have read and understood our Cookie Policy &
Concepts
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
Methods

Arrays

ArrayList

String

Tuple

Indexers

Properties

Collections & Generics

ASP.NET Interview Questions and Answer


ASP.NET is a popular framework by Microsoft for building fast and scalable web applications. It allows
developers to create dynamic websites, services, and apps, using server-side code and offering a user-…

15+ min read

Article Tags : C# Tutorials

Corporate & Communications


Address:- A-143, 7th Floor, Sovereign
Corporate Tower, Sector- 136, Noida,
Uttar Pradesh (201305) | Registered
Address:- K 061, Tower K, Gulshan
Vivante Apartment, Sector 137,
Noida, Gautam Buddh Nagar, Uttar
Pradesh, 201305

We use cookies to ensure you have the best browsing experience on our website. By
using our site, you acknowledge that you have read and understood our Cookie Policy &
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.
Company Languages DSA Data Science Web Python
About Us Python Data Structures & ML Technologies Tutorial
Legal Java Algorithms Data Science HTML Python
In Media C++ DSA for With Python CSS Programming
Contact Us PHP Beginners Data Science For JavaScript Examples
Advertise with us GoLang Basic DSA Beginner TypeScript Python Projects
GFG Corporate SQL Problems Machine ReactJS Python Tkinter
Solution R Language DSA Roadmap Learning NextJS Web Scraping
Placement Android Tutorial Top 100 DSA ML Maths Bootstrap OpenCV Tutorial
Training Program Tutorials Archive Interview Data Web Design Python Interview
GeeksforGeeks Problems Visualisation Question
Community DSA Roadmap by Pandas Django
Sandeep Jain NumPy
All Cheat Sheets NLP
Deep Learning

Computer DevOps System Inteview School GeeksforGeeks


Science Git Design Preparation Subjects Videos
Operating Linux High Level Competitive Mathematics DSA
Systems AWS Design Programming Physics Python
Computer Docker Low Level Design Top DS or Algo Chemistry Java
Network Kubernetes UML Diagrams for CP Biology C++
Database Azure Interview Guide Company-Wise Social Science Web
Management GCP Design Patterns Recruitment English Grammar Development
System DevOps OOAD Process Commerce Data Science
Software Roadmap System Design Company-Wise World GK CS Subjects
Engineering Bootcamp Preparation
Digital Logic Interview Aptitude
Design Questions Preparation
Engineering Puzzles
Maths
Software
Development
Software Testing

@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved

We use cookies to ensure you have the best browsing experience on our website. By
using our site, you acknowledge that you have read and understood our Cookie Policy &
Privacy Policy Cookies are not collected in the GeeksforGeeks mobile applications.

You might also like