Presentation C#
Presentation C#
REPORT ON
"C#
PROGRAMMING"
• BY HARSH PAL SURYAVANSHI
• BTECH CSE A
• ROLL NUMBER – 2101200100062
SUBMITTED TO
SAURABH TIWARI
TABLE OF CONTENT :-
HISTORY OF C#
WHAT IS C# ? WHERE DO WE USE IT?
FEATURES OF C#
OBJECT ORIENTED PROGRAMMING
COLLECTIONS IN C#
ERROR HANDELING IN C#
INHERITANCE
INTERFACES AND POLYMORPHISM
STRUCTS IN C#
EVENTS AND DELEGATES
REGULAR EXPRESSION
WINDOWS PRESENTATION FOUNDATION
USING DATABASE WITH C#
LINQ
C# GENERICS
THREADS IN C#
UNIT TESTING – TEST DRIVEN DEVELOPMENT(TDD)
History Of C# :-
• C
• C++
• Developed by Anders Hejlsberg
• Origins and Early Development (1999–2000)
• Official Release (2000–2002)
• C# 2.0 (2005), C# 3.0 (2007), C# 4.0 (2010), C# 5.0 (2012), C# 6.0 (2015), C# 7.0 (2017), C# 8.0 (2019), C#
9.0 (2020), C# 10.0 (2021), C# 11.0 (2022) ,upcoming C# 12.0.
• Inspiration: C# was heavily influenced by languages like C++, Java, and Delphi. The goal was to create a
language that was simple, safe, and scalable, while being as powerful as C++ but easier to use.
• Design Goals: C# was designed to support modern software development practices, including strong
typing, garbage collection, object-oriented programming, and type safety.
What is C# ?
Enumerators
Operator Overloading
•C# is object oriented. Every class is a subclass of an object. Everything is an object, yes
even primitives. This makes generic programming easier.
• Example:
• int n = 3;
• string s = n.ToString();
Enumerators:-
•Enumerators are a borrowed idea from C/C++. This is a data type consisting of a set of of
named integers.
•Example:
•enum Weekday {Mon, Tues, Wed, Thu, Fri, Sat, Sun};
Operator Overloading:-
•Operator Overloading is yet another idea borrowed from c++. This makes polymorphism
easier with custom data types.
•Example:
•Currency a, b, c;
•c = a + b;
Windows API Invocation:-
•C# was built with Windows in mind. It was created to allow programmers to create
Windows application easily through a wraparound API. Some other technologies supported
are COM, COM+.
Structured Error Handling:-
1 2 3
C# introduces new Try-catch blocks are To throw an object,
error handling used but with more it has to be a
techniques. functionality. subclass of
System.Exception.
Try-Catch:-
•C# was built with Windows in mind. It was created to allow programmers to create
Windows application easily through a wraparound API. Some other technologies supported
are COM, COM+.
Delegates:-
•Namespace is a method of organizing similar files together. This is similar in some way to
the java package idea. Every program is either explicitly within a namespace or in by
default.
•Example:
•namespace Project{ public class P1{} }
•public class P2{}
Collections in C#
• • Types of collections:
• - List<T>
• - Dictionary<TKey, TValue>
• - Queue and Stack
• • Provides dynamic memory handling.
• • Example:
• List<int> numbers = new List<int> { 1, 2, 3 };
Error Handling in C#
• • Structs are value types and can be used for lightweight objects.
• • Defined using the struct keyword.
• • Example:
• struct Point { public int X; public int Y; }
Events and Delegates
• • Language Integrated Query (LINQ) is used for querying collections and databases.
• • Syntax:
• var result = from num in numbers where num > 5 select num;
• • Offers method-based syntax with functions like Select, Where, and GroupBy.
C# Generics
• • C# supports multithreading with the Thread class and Task Parallel Library (TPL).
• • Use async/await for asynchronous programming.
• • Example:
• Task.Run(() => Console.WriteLine("Running in a separate thread"));
Unit Testing – Test Driven Development
(TDD)
•With C#’s flexibility and support for many languages through the .NET architecture it will
definitely become a widely used language in all aspects of programming.
Course
Certificat
e:-
Thank You