SlideShare une entreprise Scribd logo
1  sur  24
Why C# 
 Managed Code 
 Strongly Typed (type safe) 
 Object Oriented programming 
 Native Garbage Collection
C# Versions
Features included in Each C# 
version
C# 2.0 
 Generics 
 Partial types 
 Anonymous methods 
 Iterators 
 Nullable types 
 Getter/setter separate accessibility 
 Method group conversions (delegates) 
 Co- and Contra-variance for delegates 
 Static classes
C# 3.0 
 Implicitly typed local variables 
 Object and collection initializers 
 Auto-Implemented properties 
 Anonymous types 
 Extension methods 
 Query expressions 
 Lambda expressions 
 Expression trees 
 Partial methods
C# 4.0 
 Dynamic binding 
 Named and optional arguments 
 Generic co- and contravariance 
 Embedded interop types
C# 5.0 
 Asynchronous methods 
 Caller info attributes
Basic terms to know in C# 
 Inheritance 
 Polymorphism 
 Method Overloading 
 Method Overriding 
 Value types , Reference type 
 Boxing, Un Boxing 
 Abstract Class 
 Interface
When Abstract Class & Interface 
 If you anticipate creating multiple versions of your component, create an abstract 
class. Abstract classes provide a simple and easy way to version your components. By 
updating the base class, all inheriting classes are automatically updated with the 
change. Interfaces, on the other hand, cannot be changed once created. If a new 
version of an interface is required, you must create a whole new interface. 
 If the functionality you are creating will be useful across a wide range of disparate 
objects, use an interface. Abstract classes should be used primarily for objects that are 
closely related, whereas interfaces are best suited for providing common functionality 
to unrelated classes. 
 If you are designing small, concise bits of functionality, use interfaces. If you are 
designing large functional units, use an abstract class. 
 If you want to provide common, implemented functionality among all 
implementations of your component, use an abstract class. Abstract classes allow you 
to partially implement your class, whereas interfaces contain no implementation for 
any members.
C# keywords to know 
 Virtual 
 Override 
 Abstract 
 New 
 Sealed 
 Static
C# 2.0 - Generics 
Generics allow you to delay the specification of the data 
type of programming elements in a class or a method, 
until it is actually used in the program. In other words, 
generics allow you to write a class or method that can 
work with any data type. 
 Class declaration public class GenericList<T> 
 Method Declaration public void Add(T t), 
public List<T> GetValues()
 Features: 
C# 2.0 - Generics 
 Use generic types to maximize code reuse, type safety, and 
performance. 
 The most common use of generics is to create collection classes. 
 The .NET Framework class library contains several new generic 
collection classes in the System.Collections.Generic namespace. 
These should be used whenever possible instead of classes such 
as ArrayList in the System.Collections namespace. 
 You can create your own generic interfaces, classes, methods, 
events and delegates. 
 Generic classes may be constrained to enable access to methods 
on particular data types.
C# 2.0 – Constraints on Type 
Parameters (Generics) 
Constraint Description 
where T: struct The type argument must be a value type. Any value type except Nullable can be 
specified. See Using Nullable Types (C# Programming Guide) for more information. 
where T : class The type argument must be a reference type; this applies also to any class, interface, 
delegate, or array type. 
where T : new() The type argument must have a public parameterless constructor. When used together 
with other constraints, the new() constraint must be specified last. 
where T : <base class name> The type argument must be or derive from the specified base class. 
where T : <interface name> The type argument must be or implement the specified interface. Multiple interface 
constraints can be specified. The constraining interface can also be generic. 
where T : U The type argument supplied for T must be or derive from the argument supplied for U.
 It is possible to split the definition of a class or a struct, 
an interface or a method over two or more source files. 
Each source file contains a section of the type or method 
definition, and all parts are combined when the application 
is compiled. 
 Class Definition: 
public partial class Employee 
{ 
public void DoWork() { } 
} 
C# 2.0 – Partial Types
C# 2.0 – Partial Types 
 Restrictions 
 All partial-type definitions meant to be parts of the same type 
must be modified with partial. 
 The partial modifier can only appear immediately before the 
keywords class, struct, or interface. 
 All partial-type definitions meant to be parts of the same type 
must be defined in the same assembly and the same module 
(.exe or .dll file). Partial definitions cannot span multiple 
modules. 
 The class name and generic-type parameters must match on all 
partial-type definitions. Generic types can be partial. Each partial 
declaration must use the same parameter names in the same 
order.
C# 3.0 - Partial Methods 
A partial class or struct may contain a partial method. One part of 
the class contains the signature of the method. An optional 
implementation may be defined in the same part or another part. If 
the implementation is not supplied, then the method and all calls 
to the method are removed at compile time. 
Restriction: 
 Partial method declarations must begin with the contextual 
keyword partial and the method must return void. 
 Partial methods can have ref but not out parameters. 
 Partial methods are implicitly private, and therefore they cannot 
be virtual.
C# 2.0 - Iterators 
 An iterator can be used to step through collections such as 
lists and arrays. 
 An iterator method or get accessor performs a custom 
iteration over a collection. An iterator method uses yield 
return (C#) statement to return each element one at a 
time. When a yield return statement is reached, the 
current location in code is remembered. Execution is 
restarted from that location the next time the iterator 
function is called. 
 You consume an iterator from client code by using 
a foreach (C#) statement or by using a LINQ query.
C# 2.0 - Nullable types 
Nullable types are instances of the System.Nullable<T> struct. 
 A nullable type can represent the correct range of values for its 
underlying value type, plus an additional null value. For example, 
a Nullable<Int32>, pronounced "Nullable of Int32," can be 
assigned any value from -2147483648 to 2147483647, or it can be 
assigned the null value. 
 A Nullable<bool> can be assigned the values true false, or null. 
The ability to assign null to numeric and Boolean types is 
especially useful when you are dealing with databases and other 
data types that contain elements that may not be assigned a 
value. 
int? num = null;
C# 2.0 - Nullable types 
 Use the HasValue and Value read-only properties to test for 
null and retrieve the value, as shown in the following 
example: if(x.HasValue) j = x.Value; 
 The HasValue property returns true if the variable contains 
a value, or false if it is null. 
 The Value property returns a value if one is assigned. 
Otherwise, a System.InvalidOperationException is thrown. 
 The default value for HasValue is false. The Value property 
has no default value.
The accessor of a property contains the executable statements 
associated with getting (reading or computing) or setting (writing) 
the property. The accessor declarations can contain a get accessor, 
a set accessor, or both. 
Private name; 
public string Name 
{ 
get { return name; } 
set { name = value; } 
} 
C# 2.0 - Getter/setter separate 
accessibility (Accessors)
C# 2.0 - Static classes 
A static class is basically the same as a non-static class, but 
there is one difference: a static class cannot be instantiated. 
UtilityClass.MethodA(); 
The following list provides the main features of a static class: 
 Contains only static members. 
 Cannot be instantiated. 
 Is sealed. 
 Cannot contain Instance Constructors.
C# 2.0 - Static Members 
 A non-static class can contain static methods, fields, properties, or events. 
 The static member is callable on a class even when no instance of the class 
has been created. 
 The static member is always accessed by the class name, not the instance 
name. 
 Only one copy of a static member exists, regardless of how many instances 
of the class are created. 
 Static methods and properties cannot access non-static fields and events in 
their containing type, and they cannot access an instance variable of any 
object unless it is explicitly passed in a method parameter. 
 It is more typical to declare a non-static class with some static members, 
than to declare an entire class as static.
C# 2.0 - Static Members 
 Two common uses of static fields are to keep a count of the 
number of objects that have been instantiated, or to store a 
value that must be shared among all instances. 
 Static methods can be overloaded but not overridden, because 
they belong to the class, and not to any instance of the class. 
 Although a field cannot be declared as static const, a const field 
is essentially static in its behavior. It belongs to the type, not to 
instances of the type. Therefore, const fields can be accessed by 
using the same ClassName.MemberName notation that is used 
for static fields. No object instance is required. 
 C# does not support static local variables (variables that are 
declared in method scope).

Contenu connexe

Tendances

Ap Power Point Chpt7
Ap Power Point Chpt7Ap Power Point Chpt7
Ap Power Point Chpt7dplunkett
 
Ap Power Point Chpt5
Ap Power Point Chpt5Ap Power Point Chpt5
Ap Power Point Chpt5dplunkett
 
chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)It Academy
 
Language tour of dart
Language tour of dartLanguage tour of dart
Language tour of dartImran Qasim
 
Effective Java - Chapter 3: Methods Common to All Objects
Effective Java - Chapter 3: Methods Common to All ObjectsEffective Java - Chapter 3: Methods Common to All Objects
Effective Java - Chapter 3: Methods Common to All Objectsİbrahim Kürce
 
Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)Andrew Petryk
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsakreyi
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programmingnirajmandaliya
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4dplunkett
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statementsİbrahim Kürce
 
Top 20 c# interview Question and answers
Top 20 c# interview Question and answersTop 20 c# interview Question and answers
Top 20 c# interview Question and answersw3asp dotnet
 

Tendances (19)

Generics
GenericsGenerics
Generics
 
Ap Power Point Chpt7
Ap Power Point Chpt7Ap Power Point Chpt7
Ap Power Point Chpt7
 
Ap Power Point Chpt5
Ap Power Point Chpt5Ap Power Point Chpt5
Ap Power Point Chpt5
 
Java Generics
Java GenericsJava Generics
Java Generics
 
C# interview questions
C# interview questionsC# interview questions
C# interview questions
 
chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)
 
Language tour of dart
Language tour of dartLanguage tour of dart
Language tour of dart
 
My c++
My c++My c++
My c++
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Effective Java - Chapter 3: Methods Common to All Objects
Effective Java - Chapter 3: Methods Common to All ObjectsEffective Java - Chapter 3: Methods Common to All Objects
Effective Java - Chapter 3: Methods Common to All Objects
 
Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
 
Java interface
Java interfaceJava interface
Java interface
 
Java annotations
Java annotationsJava annotations
Java annotations
 
Top 20 c# interview Question and answers
Top 20 c# interview Question and answersTop 20 c# interview Question and answers
Top 20 c# interview Question and answers
 

En vedette

C# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageC# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageJacinto Limjap
 
C# features through examples
C# features through examplesC# features through examples
C# features through examplesZayen Chagra
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introductionPeter Gfader
 
Configuring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversConfiguring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversAxilis
 
NuGet Must Haves for LINQ
NuGet Must Haves for LINQNuGet Must Haves for LINQ
NuGet Must Haves for LINQAxilis
 
Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Jacinto Limjap
 
Python for the C# developer
Python for the C# developerPython for the C# developer
Python for the C# developerMichael Kennedy
 
C# 6.0 - DotNetNotts
C# 6.0 - DotNetNottsC# 6.0 - DotNetNotts
C# 6.0 - DotNetNottscitizenmatt
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesAbhishek Sur
 
Future of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsFuture of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsAniruddha Chakrabarti
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#Alfonso Garcia-Caro
 
코드의 품질 (Code Quality)
코드의 품질 (Code Quality)코드의 품질 (Code Quality)
코드의 품질 (Code Quality)ChulHui Lee
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#sudipv
 
게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴예림 임
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial Jm Ramos
 

En vedette (20)

C# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageC# and the Evolution of a Programming Language
C# and the Evolution of a Programming Language
 
C# features through examples
C# features through examplesC# features through examples
C# features through examples
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introduction
 
New features in C# 6
New features in C# 6New features in C# 6
New features in C# 6
 
Configuring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversConfiguring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky servers
 
NuGet Must Haves for LINQ
NuGet Must Haves for LINQNuGet Must Haves for LINQ
NuGet Must Haves for LINQ
 
Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#
 
Dynamic C#
Dynamic C# Dynamic C#
Dynamic C#
 
Python for the C# developer
Python for the C# developerPython for the C# developer
Python for the C# developer
 
C# 6.0 - DotNetNotts
C# 6.0 - DotNetNottsC# 6.0 - DotNetNotts
C# 6.0 - DotNetNotts
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and Features
 
Functional Programming with C#
Functional Programming with C#Functional Programming with C#
Functional Programming with C#
 
C# 7
C# 7C# 7
C# 7
 
Future of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsFuture of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows Platforms
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#
 
코드의 품질 (Code Quality)
코드의 품질 (Code Quality)코드의 품질 (Code Quality)
코드의 품질 (Code Quality)
 
C vs c++
C vs c++C vs c++
C vs c++
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 

Similaire à Evolution of c# - by K.Jegan (20)

Objects and Types C#
Objects and Types C#Objects and Types C#
Objects and Types C#
 
Classes2
Classes2Classes2
Classes2
 
Generics
GenericsGenerics
Generics
 
LectureNotes-02-DSA
LectureNotes-02-DSALectureNotes-02-DSA
LectureNotes-02-DSA
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
C#.net Evolution part 1
C#.net Evolution part 1C#.net Evolution part 1
C#.net Evolution part 1
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Advanced c#
Advanced c#Advanced c#
Advanced c#
 
VB.net
VB.netVB.net
VB.net
 
C# program structure
C# program structureC# program structure
C# program structure
 
C# interview-questions
C# interview-questionsC# interview-questions
C# interview-questions
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
Oop14
Oop14Oop14
Oop14
 
Application package
Application packageApplication package
Application package
 
Generics C#
Generics C#Generics C#
Generics C#
 
Notes(1).pptx
Notes(1).pptxNotes(1).pptx
Notes(1).pptx
 
C#ppt
C#pptC#ppt
C#ppt
 

Dernier

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 

Dernier (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 

Evolution of c# - by K.Jegan

  • 1.
  • 2. Why C#  Managed Code  Strongly Typed (type safe)  Object Oriented programming  Native Garbage Collection
  • 4. Features included in Each C# version
  • 5. C# 2.0  Generics  Partial types  Anonymous methods  Iterators  Nullable types  Getter/setter separate accessibility  Method group conversions (delegates)  Co- and Contra-variance for delegates  Static classes
  • 6. C# 3.0  Implicitly typed local variables  Object and collection initializers  Auto-Implemented properties  Anonymous types  Extension methods  Query expressions  Lambda expressions  Expression trees  Partial methods
  • 7. C# 4.0  Dynamic binding  Named and optional arguments  Generic co- and contravariance  Embedded interop types
  • 8. C# 5.0  Asynchronous methods  Caller info attributes
  • 9. Basic terms to know in C#  Inheritance  Polymorphism  Method Overloading  Method Overriding  Value types , Reference type  Boxing, Un Boxing  Abstract Class  Interface
  • 10. When Abstract Class & Interface  If you anticipate creating multiple versions of your component, create an abstract class. Abstract classes provide a simple and easy way to version your components. By updating the base class, all inheriting classes are automatically updated with the change. Interfaces, on the other hand, cannot be changed once created. If a new version of an interface is required, you must create a whole new interface.  If the functionality you are creating will be useful across a wide range of disparate objects, use an interface. Abstract classes should be used primarily for objects that are closely related, whereas interfaces are best suited for providing common functionality to unrelated classes.  If you are designing small, concise bits of functionality, use interfaces. If you are designing large functional units, use an abstract class.  If you want to provide common, implemented functionality among all implementations of your component, use an abstract class. Abstract classes allow you to partially implement your class, whereas interfaces contain no implementation for any members.
  • 11. C# keywords to know  Virtual  Override  Abstract  New  Sealed  Static
  • 12. C# 2.0 - Generics Generics allow you to delay the specification of the data type of programming elements in a class or a method, until it is actually used in the program. In other words, generics allow you to write a class or method that can work with any data type.  Class declaration public class GenericList<T>  Method Declaration public void Add(T t), public List<T> GetValues()
  • 13.  Features: C# 2.0 - Generics  Use generic types to maximize code reuse, type safety, and performance.  The most common use of generics is to create collection classes.  The .NET Framework class library contains several new generic collection classes in the System.Collections.Generic namespace. These should be used whenever possible instead of classes such as ArrayList in the System.Collections namespace.  You can create your own generic interfaces, classes, methods, events and delegates.  Generic classes may be constrained to enable access to methods on particular data types.
  • 14. C# 2.0 – Constraints on Type Parameters (Generics) Constraint Description where T: struct The type argument must be a value type. Any value type except Nullable can be specified. See Using Nullable Types (C# Programming Guide) for more information. where T : class The type argument must be a reference type; this applies also to any class, interface, delegate, or array type. where T : new() The type argument must have a public parameterless constructor. When used together with other constraints, the new() constraint must be specified last. where T : <base class name> The type argument must be or derive from the specified base class. where T : <interface name> The type argument must be or implement the specified interface. Multiple interface constraints can be specified. The constraining interface can also be generic. where T : U The type argument supplied for T must be or derive from the argument supplied for U.
  • 15.  It is possible to split the definition of a class or a struct, an interface or a method over two or more source files. Each source file contains a section of the type or method definition, and all parts are combined when the application is compiled.  Class Definition: public partial class Employee { public void DoWork() { } } C# 2.0 – Partial Types
  • 16. C# 2.0 – Partial Types  Restrictions  All partial-type definitions meant to be parts of the same type must be modified with partial.  The partial modifier can only appear immediately before the keywords class, struct, or interface.  All partial-type definitions meant to be parts of the same type must be defined in the same assembly and the same module (.exe or .dll file). Partial definitions cannot span multiple modules.  The class name and generic-type parameters must match on all partial-type definitions. Generic types can be partial. Each partial declaration must use the same parameter names in the same order.
  • 17. C# 3.0 - Partial Methods A partial class or struct may contain a partial method. One part of the class contains the signature of the method. An optional implementation may be defined in the same part or another part. If the implementation is not supplied, then the method and all calls to the method are removed at compile time. Restriction:  Partial method declarations must begin with the contextual keyword partial and the method must return void.  Partial methods can have ref but not out parameters.  Partial methods are implicitly private, and therefore they cannot be virtual.
  • 18. C# 2.0 - Iterators  An iterator can be used to step through collections such as lists and arrays.  An iterator method or get accessor performs a custom iteration over a collection. An iterator method uses yield return (C#) statement to return each element one at a time. When a yield return statement is reached, the current location in code is remembered. Execution is restarted from that location the next time the iterator function is called.  You consume an iterator from client code by using a foreach (C#) statement or by using a LINQ query.
  • 19. C# 2.0 - Nullable types Nullable types are instances of the System.Nullable<T> struct.  A nullable type can represent the correct range of values for its underlying value type, plus an additional null value. For example, a Nullable<Int32>, pronounced "Nullable of Int32," can be assigned any value from -2147483648 to 2147483647, or it can be assigned the null value.  A Nullable<bool> can be assigned the values true false, or null. The ability to assign null to numeric and Boolean types is especially useful when you are dealing with databases and other data types that contain elements that may not be assigned a value. int? num = null;
  • 20. C# 2.0 - Nullable types  Use the HasValue and Value read-only properties to test for null and retrieve the value, as shown in the following example: if(x.HasValue) j = x.Value;  The HasValue property returns true if the variable contains a value, or false if it is null.  The Value property returns a value if one is assigned. Otherwise, a System.InvalidOperationException is thrown.  The default value for HasValue is false. The Value property has no default value.
  • 21. The accessor of a property contains the executable statements associated with getting (reading or computing) or setting (writing) the property. The accessor declarations can contain a get accessor, a set accessor, or both. Private name; public string Name { get { return name; } set { name = value; } } C# 2.0 - Getter/setter separate accessibility (Accessors)
  • 22. C# 2.0 - Static classes A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. UtilityClass.MethodA(); The following list provides the main features of a static class:  Contains only static members.  Cannot be instantiated.  Is sealed.  Cannot contain Instance Constructors.
  • 23. C# 2.0 - Static Members  A non-static class can contain static methods, fields, properties, or events.  The static member is callable on a class even when no instance of the class has been created.  The static member is always accessed by the class name, not the instance name.  Only one copy of a static member exists, regardless of how many instances of the class are created.  Static methods and properties cannot access non-static fields and events in their containing type, and they cannot access an instance variable of any object unless it is explicitly passed in a method parameter.  It is more typical to declare a non-static class with some static members, than to declare an entire class as static.
  • 24. C# 2.0 - Static Members  Two common uses of static fields are to keep a count of the number of objects that have been instantiated, or to store a value that must be shared among all instances.  Static methods can be overloaded but not overridden, because they belong to the class, and not to any instance of the class.  Although a field cannot be declared as static const, a const field is essentially static in its behavior. It belongs to the type, not to instances of the type. Therefore, const fields can be accessed by using the same ClassName.MemberName notation that is used for static fields. No object instance is required.  C# does not support static local variables (variables that are declared in method scope).