SlideShare a Scribd company logo
.NET 4.0 FEATURES
NAMED AND OPTIONAL ARGUMENTS 
Optional Arguments: 
 Optional arguments enable you to omit arguments for some parameters. 
 When a function has an optional parameter, the caller can decide whether to 
provide a value or not. 
 If the caller doesn't provide a value, the function uses a default value.
Named Arguments: 
 Named arguments enable you to specify an argument for a particular 
parameter by associating the argument with the parameter's name 
rather than with the parameter's position in the parameter list. 
 Named arguments free you from the need to remember or to look 
up the order of parameters in the parameter lists of called methods. 
Calculate(weight: 123, height: 64);
Dynamic: 
 Dynamic is a new static type that acts like a placeholder for a type 
not known until runtime. 
 At compile time, an element that is typed as dynamic is assumed to 
support any operation. 
Ex: 
dynamic dynamic_ec = new ExampleClass(); 
// The following line is not identified as an error by the 
// compiler, but it causes a run-time exception. 
dynamic_ec.exampleMethod1(10, 4); 
//no method with two parameters
VAR DYNAMIC 
Introduced in C# 3.0 Introduced in C# 4.0 
Statically typed – This means 
the type of variable declared is 
decided by the compiler at 
compile time. 
Dynamically typed - This 
means the type of variable 
declared is decided by the 
compiler at runtime time. 
Need to initialize at the time 
of declaration. 
No need to initialize at the 
time of declaration. 
Errors are caught at compile 
time. 
Errors are caught at runtime 
Visual Studio shows 
intellisense since the type of 
variable assigned is known to 
compiler. 
Intellisense is not 
available since the type and its 
related methods and 
properties can be known at run 
time only
Reflection Dynamic 
Inspect (meta-data) Yes No 
Invoke public members Yes Yes 
Invoke private members Yes No 
Caching No Yes 
Static class Yes No
Covariance and Contravariance: 
Covariance: 
 Covariance preserves assignment compatibility. 
 An object of a more derived type is assigned to an object of a less 
derived type. 
Contravariance: 
 An object that is instantiated with a less derived type argument 
is assigned to an object instantiated with a more derived type 
argument. 
 Assignment compatibility is reversed.
// Assignment compatibility. 
string str = "test"; 
// An object of a more derived type is assigned to an object of a less derived type. 
object obj = str; 
// Covariance. 
IEnumerable<string> strings = new List<string>(); 
IEnumerable<object> objects = strings; 
// Contravariance. 
// Assume that the following method is in the class: 
// static void SetObject(object o) { } 
Action<object> actObject = SetObject; 
Action<string> actString = actObject;
Dynamic Language Runtime: 
 The dynamic language runtime (DLR) is a runtime environment that 
adds a set of services for dynamic languages to the common 
language runtime (CLR). 
 The DLR makes it easier to develop dynamic languages to run on the 
.NET Framework and to add dynamic features to statically typed 
languages. 
 Dynamic languages can identify the type of an object at run time, 
whereas in statically typed languages such as C# and Visual Basic 
you must specify object types at design time. 
 Examples of dynamic languages are Lisp, Smalltalk, JavaScript, PHP, 
Ruby, Python, ColdFusion, Lua, Cobra, and Groovy.
Expression Trees: 
 The DLR uses expression trees to represent language semantics. For this 
purpose, the DLR has extended LINQ expression trees to include control flow, 
assignment, and other language-modeling nodes. 
Call Site Caching: 
 A dynamic call site is a place in the code where you perform an operation on 
dynamic objects. 
 The DLR caches the characteristics of a and b (usually the types of these 
objects) and information about the operation. 
Dynamic Object Interoperability: 
 The DLR provides a set of classes and interfaces that represent dynamic 
objects and operations and can be used by language implementers and 
authors of dynamic libraries.
int Fibonacci(int n) 
{ 
if (n < 1) 
{ 
return 1; 
} 
else 
{ 
return Fibonacci(n ‐ 1) + Fibonacci(n ‐ 2); 
} 
}
C#4.0 features

More Related Content

What's hot

Virtual Function
Virtual FunctionVirtual Function
C# Basics
C# BasicsC# Basics
Storage class
Storage classStorage class
Storage class
Kathmandu University
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
Cihad Horuzoğlu
 
pebble - Building apps on pebble
pebble - Building apps on pebblepebble - Building apps on pebble
pebble - Building apps on pebble
Aniruddha Chakrabarti
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
SadhanaParameswaran
 
Andy On Closures
Andy On ClosuresAndy On Closures
Andy On Closures
melbournepatterns
 
2CPP04 - Objects and Classes
2CPP04 - Objects and Classes2CPP04 - Objects and Classes
2CPP04 - Objects and Classes
Michael Heron
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
Amir Ali
 
JS - Basics
JS - BasicsJS - Basics
JS - Basics
John Fischer
 
Simplicitly
SimplicitlySimplicitly
Simplicitly
Martin Odersky
 
Dart programming language
Dart programming languageDart programming language
Dart programming language
Aniruddha Chakrabarti
 
Dart workshop
Dart workshopDart workshop
Dart workshop
Vishnu Suresh
 
More Little Wonders of C#/.NET
More Little Wonders of C#/.NETMore Little Wonders of C#/.NET
More Little Wonders of C#/.NET
BlackRabbitCoder
 
Polymorphism and its types
Polymorphism and its typesPolymorphism and its types
Polymorphism and its types
Suraj Bora
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
Todor Kolev
 
Learn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator OverloadingLearn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator Overloading
Eng Teong Cheah
 
Chapter1pp
Chapter1ppChapter1pp
Chapter1pp
J. C.
 

What's hot (20)

Virtual Function
Virtual FunctionVirtual Function
Virtual Function
 
C# Basics
C# BasicsC# Basics
C# Basics
 
Storage class
Storage classStorage class
Storage class
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
pebble - Building apps on pebble
pebble - Building apps on pebblepebble - Building apps on pebble
pebble - Building apps on pebble
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Andy On Closures
Andy On ClosuresAndy On Closures
Andy On Closures
 
2CPP04 - Objects and Classes
2CPP04 - Objects and Classes2CPP04 - Objects and Classes
2CPP04 - Objects and Classes
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
JS - Basics
JS - BasicsJS - Basics
JS - Basics
 
Simplicitly
SimplicitlySimplicitly
Simplicitly
 
Dart programming language
Dart programming languageDart programming language
Dart programming language
 
Dart workshop
Dart workshopDart workshop
Dart workshop
 
More Little Wonders of C#/.NET
More Little Wonders of C#/.NETMore Little Wonders of C#/.NET
More Little Wonders of C#/.NET
 
Polymorphism and its types
Polymorphism and its typesPolymorphism and its types
Polymorphism and its types
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Learn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator OverloadingLearn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator Overloading
 
Chapter1pp
Chapter1ppChapter1pp
Chapter1pp
 

Viewers also liked

Requirements elicitation
Requirements elicitationRequirements elicitation
Requirements elicitation
Abdul Basit
 
use case diagramHospital managment system
use case diagramHospital managment systemuse case diagramHospital managment system
use case diagramHospital managment system
Yaswanth Babu Gummadivelli
 
Usecase diagram railway reservation system
Usecase diagram railway reservation systemUsecase diagram railway reservation system
Usecase diagram railway reservation systemmuthumeenakshim
 
Bill Gates
Bill GatesBill Gates
multi threading
multi threadingmulti threading
collections
 collections collections
exception handling
 exception handling exception handling
exception handling
Yaswanth Babu Gummadivelli
 
business analyst interview questions and answers
business analyst interview questions and answersbusiness analyst interview questions and answers
business analyst interview questions and answers
Congress Man
 
Generics collections
Generics collectionsGenerics collections
Generics collections
Yaswanth Babu Gummadivelli
 
Business analyst interview questions and answers
Business analyst interview questions and answersBusiness analyst interview questions and answers
Business analyst interview questions and answers
Robin G
 
Use of ict tools for teaching –learning
Use of ict tools for teaching –learningUse of ict tools for teaching –learning
Use of ict tools for teaching –learning
Venkat Srinivasan
 
Use Case Modeling
Use Case ModelingUse Case Modeling
Use Case Modeling
Venkat Srinivasan
 
Business Analyst Training
Business  Analyst  TrainingBusiness  Analyst  Training
Business Analyst Training
Craig Brown
 
Business Analysis Fundamentals
Business Analysis FundamentalsBusiness Analysis Fundamentals
Business Analysis Fundamentals
waelsaid75
 
Business analyst ppt
Business analyst pptBusiness analyst ppt
Business analyst ppt
Yaswanth Babu Gummadivelli
 
Business analysis interview question and answers
Business analysis interview question and answersBusiness analysis interview question and answers
Business analysis interview question and answers
Garuda Trainings
 
85 business analyst interview questions and answers
85 business analyst interview questions and answers85 business analyst interview questions and answers
85 business analyst interview questions and answers
BusinessAnalyst247
 

Viewers also liked (17)

Requirements elicitation
Requirements elicitationRequirements elicitation
Requirements elicitation
 
use case diagramHospital managment system
use case diagramHospital managment systemuse case diagramHospital managment system
use case diagramHospital managment system
 
Usecase diagram railway reservation system
Usecase diagram railway reservation systemUsecase diagram railway reservation system
Usecase diagram railway reservation system
 
Bill Gates
Bill GatesBill Gates
Bill Gates
 
multi threading
multi threadingmulti threading
multi threading
 
collections
 collections collections
collections
 
exception handling
 exception handling exception handling
exception handling
 
business analyst interview questions and answers
business analyst interview questions and answersbusiness analyst interview questions and answers
business analyst interview questions and answers
 
Generics collections
Generics collectionsGenerics collections
Generics collections
 
Business analyst interview questions and answers
Business analyst interview questions and answersBusiness analyst interview questions and answers
Business analyst interview questions and answers
 
Use of ict tools for teaching –learning
Use of ict tools for teaching –learningUse of ict tools for teaching –learning
Use of ict tools for teaching –learning
 
Use Case Modeling
Use Case ModelingUse Case Modeling
Use Case Modeling
 
Business Analyst Training
Business  Analyst  TrainingBusiness  Analyst  Training
Business Analyst Training
 
Business Analysis Fundamentals
Business Analysis FundamentalsBusiness Analysis Fundamentals
Business Analysis Fundamentals
 
Business analyst ppt
Business analyst pptBusiness analyst ppt
Business analyst ppt
 
Business analysis interview question and answers
Business analysis interview question and answersBusiness analysis interview question and answers
Business analysis interview question and answers
 
85 business analyst interview questions and answers
85 business analyst interview questions and answers85 business analyst interview questions and answers
85 business analyst interview questions and answers
 

Similar to C#4.0 features

Introduction to c sharp 4.0 and dynamic
Introduction to c sharp 4.0 and dynamicIntroduction to c sharp 4.0 and dynamic
Introduction to c sharp 4.0 and dynamic
Gieno Miao
 
Net framework
Net frameworkNet framework
Net framework
Tuan Ngo
 
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
abdulhaq467432
 
Cs30 New
Cs30 NewCs30 New
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
Saurabh Narula
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
VijalJain3
 
2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)
Shoaib Ghachi
 
chap04.ppt
chap04.pptchap04.ppt
chap04.ppt
Varsha Uchagaonkar
 
C# Unit 1 notes
C# Unit 1 notesC# Unit 1 notes
C# Unit 1 notes
Sudarshan Dhondaley
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
akreyi
 
C# note
C# noteC# note
VB.net
VB.netVB.net
VB.net
PallaviKadam
 
Managing Binary Compatibility in Scala (Scala Lift Off 2011)
Managing Binary Compatibility in Scala (Scala Lift Off 2011)Managing Binary Compatibility in Scala (Scala Lift Off 2011)
Managing Binary Compatibility in Scala (Scala Lift Off 2011)
mircodotta
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
nirajmandaliya
 
Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)
nirajmandaliya
 
Unit 2 Principles of Programming Languages
Unit 2 Principles of Programming LanguagesUnit 2 Principles of Programming Languages
Unit 2 Principles of Programming Languages
Vasavi College of Engg
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
Raveendra R
 
Unit 1
Unit  1Unit  1
Unit 1
donny101
 
C sharp
C sharpC sharp
C sharp
Satish Verma
 
Java
JavaJava

Similar to C#4.0 features (20)

Introduction to c sharp 4.0 and dynamic
Introduction to c sharp 4.0 and dynamicIntroduction to c sharp 4.0 and dynamic
Introduction to c sharp 4.0 and dynamic
 
Net framework
Net frameworkNet framework
Net framework
 
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
 
Cs30 New
Cs30 NewCs30 New
Cs30 New
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)
 
chap04.ppt
chap04.pptchap04.ppt
chap04.ppt
 
C# Unit 1 notes
C# Unit 1 notesC# Unit 1 notes
C# Unit 1 notes
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
C# note
C# noteC# note
C# note
 
VB.net
VB.netVB.net
VB.net
 
Managing Binary Compatibility in Scala (Scala Lift Off 2011)
Managing Binary Compatibility in Scala (Scala Lift Off 2011)Managing Binary Compatibility in Scala (Scala Lift Off 2011)
Managing Binary Compatibility in Scala (Scala Lift Off 2011)
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
 
Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)
 
Unit 2 Principles of Programming Languages
Unit 2 Principles of Programming LanguagesUnit 2 Principles of Programming Languages
Unit 2 Principles of Programming Languages
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Unit 1
Unit  1Unit  1
Unit 1
 
C sharp
C sharpC sharp
C sharp
 
Java
JavaJava
Java
 

More from Yaswanth Babu Gummadivelli

Presentation on BA
Presentation on BAPresentation on BA
Presentation on BA
Yaswanth Babu Gummadivelli
 
Ba -content
Ba -contentBa -content
E commerce use case documentation.
E commerce use case documentation.E commerce use case documentation.
E commerce use case documentation.
Yaswanth Babu Gummadivelli
 
MOM on activity diagram
MOM on activity diagramMOM on activity diagram
MOM on activity diagram
Yaswanth Babu Gummadivelli
 
UML Diagrams
UML DiagramsUML Diagrams
MOM on BA
MOM on BAMOM on BA
Constructors
Constructors Constructors
array
array array
Use case for atm
Use case for atmUse case for atm
Use case for atm
Yaswanth Babu Gummadivelli
 
Activity diagram for ticket vending machine
Activity diagram for ticket vending machineActivity diagram for ticket vending machine
Activity diagram for ticket vending machine
Yaswanth Babu Gummadivelli
 
Extreme programming
Extreme programmingExtreme programming
Extreme programming
Yaswanth Babu Gummadivelli
 
Agile model
Agile model Agile model
Business Analyst
Business AnalystBusiness Analyst
Business Analyst
Yaswanth Babu Gummadivelli
 
CRM and ERP
CRM and ERPCRM and ERP
Reflection
ReflectionReflection
Exceptions in SQL Server
Exceptions in SQL ServerExceptions in SQL Server
Exceptions in SQL Server
Yaswanth Babu Gummadivelli
 
Views
ViewsViews
Triggers
TriggersTriggers
Subqueries
SubqueriesSubqueries

More from Yaswanth Babu Gummadivelli (20)

Presentation on BA
Presentation on BAPresentation on BA
Presentation on BA
 
ERP
ERPERP
ERP
 
Ba -content
Ba -contentBa -content
Ba -content
 
E commerce use case documentation.
E commerce use case documentation.E commerce use case documentation.
E commerce use case documentation.
 
MOM on activity diagram
MOM on activity diagramMOM on activity diagram
MOM on activity diagram
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
MOM on BA
MOM on BAMOM on BA
MOM on BA
 
Constructors
Constructors Constructors
Constructors
 
array
array array
array
 
Use case for atm
Use case for atmUse case for atm
Use case for atm
 
Activity diagram for ticket vending machine
Activity diagram for ticket vending machineActivity diagram for ticket vending machine
Activity diagram for ticket vending machine
 
Extreme programming
Extreme programmingExtreme programming
Extreme programming
 
Agile model
Agile model Agile model
Agile model
 
Business Analyst
Business AnalystBusiness Analyst
Business Analyst
 
CRM and ERP
CRM and ERPCRM and ERP
CRM and ERP
 
Reflection
ReflectionReflection
Reflection
 
Exceptions in SQL Server
Exceptions in SQL ServerExceptions in SQL Server
Exceptions in SQL Server
 
Views
ViewsViews
Views
 
Triggers
TriggersTriggers
Triggers
 
Subqueries
SubqueriesSubqueries
Subqueries
 

Recently uploaded

Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 

Recently uploaded (20)

Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 

C#4.0 features

  • 2. NAMED AND OPTIONAL ARGUMENTS Optional Arguments:  Optional arguments enable you to omit arguments for some parameters.  When a function has an optional parameter, the caller can decide whether to provide a value or not.  If the caller doesn't provide a value, the function uses a default value.
  • 3. Named Arguments:  Named arguments enable you to specify an argument for a particular parameter by associating the argument with the parameter's name rather than with the parameter's position in the parameter list.  Named arguments free you from the need to remember or to look up the order of parameters in the parameter lists of called methods. Calculate(weight: 123, height: 64);
  • 4. Dynamic:  Dynamic is a new static type that acts like a placeholder for a type not known until runtime.  At compile time, an element that is typed as dynamic is assumed to support any operation. Ex: dynamic dynamic_ec = new ExampleClass(); // The following line is not identified as an error by the // compiler, but it causes a run-time exception. dynamic_ec.exampleMethod1(10, 4); //no method with two parameters
  • 5. VAR DYNAMIC Introduced in C# 3.0 Introduced in C# 4.0 Statically typed – This means the type of variable declared is decided by the compiler at compile time. Dynamically typed - This means the type of variable declared is decided by the compiler at runtime time. Need to initialize at the time of declaration. No need to initialize at the time of declaration. Errors are caught at compile time. Errors are caught at runtime Visual Studio shows intellisense since the type of variable assigned is known to compiler. Intellisense is not available since the type and its related methods and properties can be known at run time only
  • 6. Reflection Dynamic Inspect (meta-data) Yes No Invoke public members Yes Yes Invoke private members Yes No Caching No Yes Static class Yes No
  • 7. Covariance and Contravariance: Covariance:  Covariance preserves assignment compatibility.  An object of a more derived type is assigned to an object of a less derived type. Contravariance:  An object that is instantiated with a less derived type argument is assigned to an object instantiated with a more derived type argument.  Assignment compatibility is reversed.
  • 8. // Assignment compatibility. string str = "test"; // An object of a more derived type is assigned to an object of a less derived type. object obj = str; // Covariance. IEnumerable<string> strings = new List<string>(); IEnumerable<object> objects = strings; // Contravariance. // Assume that the following method is in the class: // static void SetObject(object o) { } Action<object> actObject = SetObject; Action<string> actString = actObject;
  • 9. Dynamic Language Runtime:  The dynamic language runtime (DLR) is a runtime environment that adds a set of services for dynamic languages to the common language runtime (CLR).  The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages.  Dynamic languages can identify the type of an object at run time, whereas in statically typed languages such as C# and Visual Basic you must specify object types at design time.  Examples of dynamic languages are Lisp, Smalltalk, JavaScript, PHP, Ruby, Python, ColdFusion, Lua, Cobra, and Groovy.
  • 10.
  • 11. Expression Trees:  The DLR uses expression trees to represent language semantics. For this purpose, the DLR has extended LINQ expression trees to include control flow, assignment, and other language-modeling nodes. Call Site Caching:  A dynamic call site is a place in the code where you perform an operation on dynamic objects.  The DLR caches the characteristics of a and b (usually the types of these objects) and information about the operation. Dynamic Object Interoperability:  The DLR provides a set of classes and interfaces that represent dynamic objects and operations and can be used by language implementers and authors of dynamic libraries.
  • 12. int Fibonacci(int n) { if (n < 1) { return 1; } else { return Fibonacci(n ‐ 1) + Fibonacci(n ‐ 2); } }