SlideShare una empresa de Scribd logo
1 de 22
C# 4.0 and .NET 4.0 Buu Nguyen, MVP (ASP.NET) www.buunguyen.net/blog buunguyen@kms-technology.com Microsoft Confidential 1
Agenda Optional and Named Parameters Covariance and Contravariance Dynamic Binding Threading with Task API Task Parallel Library (TPL) PLINQ
Optional and Named Parameters
?Quiz What are 2 issues of this API?
Covariance and Contravariance
?Quiz What is wrong with this code?
Covariance Defined Let’s say S is subtype of B and GT is a generic type GT<S> behaves like subtype of GT<B> on assignment compatibility, i.e. GT<S> s = … GT<B> b = s; GT<S> s = (GT<S>)b; Safe only when GT doesn’t expose members “receiving” T as input (aka input-safe) Microsoft Confidential 7
?Quiz What is wrong with this code?
Contravariance Defined Let’s say S is subtype of B and GT is a generic type GT<B> behaves like subtype of GT<S> on assignment compatibility, i.e. GT<B> b = … GT<S> s = b; GT<B> b = (GT<B>)s; Safe only when GT doesn’t expose members “returning” T as output (aka output-safe) Microsoft Confidential 9
Dynamic Binding
?Quiz Write a method that prints out the Name property of an anonymous object returned by another method
Dynamic binding means… use runtime type for all bindings
?Quiz A method summing Length properties of all parameters, regardless of actual type
?Quiz How to builds C# objects that behave like JavaScript objects, i.e. members can be added at any time?
?Quiz Write a class whose objects can invoke static methods of any particular type Bonus #1: include non-public static methods Bonus #2: ignore case
?Quiz Write a class whose objects can be used as result-caching proxy for the method invocation of any other object
Task Parallel Library (TPL) & PLINQ
?Quiz Write a method calculating Fibonacci number using a thread in thread-pool and returning result to caller
Task Parallelism Features Wait on tasks Support parent-child relationship Exception handling Cancelling tasks Continuation Execute one task after another Microsoft Confidential 19
?Quiz Write 3 methods: Calculate some known Fibonacci numbers Calculate Fibonacci numbers for a range Calculate Fibonacci numbers for a list of specified indexes Each calculation must take place in a thread in thread-pool
Parallel Class Assign delegates to a handful of Task instances, not one-to-one mapping
?Quiz Write a method which calculate some specified Fibonacci numbers and return the sum of them to the caller

Más contenido relacionado

La actualidad más candente

C#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New FeaturesC#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New Featurestechfreak
 
Testing Challenges within Agile Teams
Testing Challenges within Agile TeamsTesting Challenges within Agile Teams
Testing Challenges within Agile TeamsTechWell
 
Elixir Brasil 2019 - Quality: A Panacéia para seu código Elixir
Elixir Brasil 2019 - Quality:  A Panacéia para seu código ElixirElixir Brasil 2019 - Quality:  A Panacéia para seu código Elixir
Elixir Brasil 2019 - Quality: A Panacéia para seu código ElixirWeverton Timoteo
 
PHP Reactive Programming at Medan Tech Day 2018
PHP Reactive Programming at Medan Tech Day 2018PHP Reactive Programming at Medan Tech Day 2018
PHP Reactive Programming at Medan Tech Day 2018Dolly Aswin Harahap
 
Data Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolData Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolIvan Ruchkin
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesArghodeepPaul
 
End-to-End Machine learning pipelines for Python driven organizations - Nick ...
End-to-End Machine learning pipelines for Python driven organizations - Nick ...End-to-End Machine learning pipelines for Python driven organizations - Nick ...
End-to-End Machine learning pipelines for Python driven organizations - Nick ...PyData
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Python Programming language
Python Programming languagePython Programming language
Python Programming languageHadeelAlbedah
 
CS152 Programming Paradigm
CS152 Programming Paradigm CS152 Programming Paradigm
CS152 Programming Paradigm Kaya Ota
 
Review june2014 june2015
Review june2014 june2015Review june2014 june2015
Review june2014 june2015Ikuru Kanuma
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languagesMikhail Barash
 

La actualidad más candente (18)

C#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New FeaturesC#3.0 & Vb 9.0 New Features
C#3.0 & Vb 9.0 New Features
 
Testing Challenges within Agile Teams
Testing Challenges within Agile TeamsTesting Challenges within Agile Teams
Testing Challenges within Agile Teams
 
ANTLR4 in depth
ANTLR4 in depthANTLR4 in depth
ANTLR4 in depth
 
Elixir Brasil 2019 - Quality: A Panacéia para seu código Elixir
Elixir Brasil 2019 - Quality:  A Panacéia para seu código ElixirElixir Brasil 2019 - Quality:  A Panacéia para seu código Elixir
Elixir Brasil 2019 - Quality: A Panacéia para seu código Elixir
 
PHP Reactive Programming at Medan Tech Day 2018
PHP Reactive Programming at Medan Tech Day 2018PHP Reactive Programming at Medan Tech Day 2018
PHP Reactive Programming at Medan Tech Day 2018
 
Data Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolData Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification Tool
 
From Java to Kotlin
From Java to KotlinFrom Java to Kotlin
From Java to Kotlin
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notes
 
End-to-End Machine learning pipelines for Python driven organizations - Nick ...
End-to-End Machine learning pipelines for Python driven organizations - Nick ...End-to-End Machine learning pipelines for Python driven organizations - Nick ...
End-to-End Machine learning pipelines for Python driven organizations - Nick ...
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Python Programming language
Python Programming languagePython Programming language
Python Programming language
 
CS152 Programming Paradigm
CS152 Programming Paradigm CS152 Programming Paradigm
CS152 Programming Paradigm
 
Review june2014 june2015
Review june2014 june2015Review june2014 june2015
Review june2014 june2015
 
Code Reviews in Python - PyZh
Code Reviews in Python - PyZhCode Reviews in Python - PyZh
Code Reviews in Python - PyZh
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languages
 
Kotlin
KotlinKotlin
Kotlin
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Programming paradigms
Programming paradigmsProgramming paradigms
Programming paradigms
 

Destacado

Csharp ebook
Csharp ebookCsharp ebook
Csharp ebook988633
 
Switch to Results in Hotels
Switch to Results in HotelsSwitch to Results in Hotels
Switch to Results in HotelsJack Watson
 
Xamarin Cross-Platform with Xamarin.Form, MvvmCross
Xamarin Cross-Platform with Xamarin.Form, MvvmCrossXamarin Cross-Platform with Xamarin.Form, MvvmCross
Xamarin Cross-Platform with Xamarin.Form, MvvmCrossTri Nguyen
 
Xamarin 3 hieu 19-06
Xamarin 3   hieu 19-06Xamarin 3   hieu 19-06
Xamarin 3 hieu 19-06Nguyen Hieu
 
Enterprise Mobile Success with Oracle and Xamarin
Enterprise Mobile Success with Oracle and XamarinEnterprise Mobile Success with Oracle and Xamarin
Enterprise Mobile Success with Oracle and XamarinXamarin
 
C# 6.0 - What?! C# is being updated?
C# 6.0 - What?! C# is being updated?C# 6.0 - What?! C# is being updated?
C# 6.0 - What?! C# is being updated?Filip Ekberg
 
Mobile Enterprise Success with Xamarin and IBM
Mobile Enterprise Success with Xamarin and IBMMobile Enterprise Success with Xamarin and IBM
Mobile Enterprise Success with Xamarin and IBMXamarin
 
C# 3.0 and 4.0
C# 3.0 and 4.0C# 3.0 and 4.0
C# 3.0 and 4.0Buu Nguyen
 
Mobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with XamarinMobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with XamarinNick Landry
 
Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...
Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...
Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...Xamarin
 
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...Xamarin
 
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOpsXamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOpsXamarin
 
Building Your First Xamarin.Forms App
Building Your First Xamarin.Forms AppBuilding Your First Xamarin.Forms App
Building Your First Xamarin.Forms AppXamarin
 
Xamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.com
Xamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.comXamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.com
Xamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.comKhoi Pham
 
Building Your First Android App with Xamarin
Building Your First Android App with XamarinBuilding Your First Android App with Xamarin
Building Your First Android App with XamarinXamarin
 
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#Xamarin
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Xamarin
 

Destacado (20)

Csharp ebook
Csharp ebookCsharp ebook
Csharp ebook
 
C# 4.0 dynamic
C# 4.0 dynamicC# 4.0 dynamic
C# 4.0 dynamic
 
Dynamic C#
Dynamic C# Dynamic C#
Dynamic C#
 
Switch to Results in Hotels
Switch to Results in HotelsSwitch to Results in Hotels
Switch to Results in Hotels
 
Xamarin Cross-Platform with Xamarin.Form, MvvmCross
Xamarin Cross-Platform with Xamarin.Form, MvvmCrossXamarin Cross-Platform with Xamarin.Form, MvvmCross
Xamarin Cross-Platform with Xamarin.Form, MvvmCross
 
Xamarin 3 hieu 19-06
Xamarin 3   hieu 19-06Xamarin 3   hieu 19-06
Xamarin 3 hieu 19-06
 
C# Is The Future
C# Is The FutureC# Is The Future
C# Is The Future
 
Enterprise Mobile Success with Oracle and Xamarin
Enterprise Mobile Success with Oracle and XamarinEnterprise Mobile Success with Oracle and Xamarin
Enterprise Mobile Success with Oracle and Xamarin
 
C# 6.0 - What?! C# is being updated?
C# 6.0 - What?! C# is being updated?C# 6.0 - What?! C# is being updated?
C# 6.0 - What?! C# is being updated?
 
Mobile Enterprise Success with Xamarin and IBM
Mobile Enterprise Success with Xamarin and IBMMobile Enterprise Success with Xamarin and IBM
Mobile Enterprise Success with Xamarin and IBM
 
C# 3.0 and 4.0
C# 3.0 and 4.0C# 3.0 and 4.0
C# 3.0 and 4.0
 
Mobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with XamarinMobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with Xamarin
 
Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...
Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...
Xamarin Mobile Leaders Summit: Business at the Point of Inspiration: Producti...
 
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
Xamarin Mobile Leaders Summit: The Mobile Mind Shift: Opportunities, Challeng...
 
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOpsXamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
Xamarin Mobile Leaders Summit | Solving the Unique Challenges in Mobile DevOps
 
Building Your First Xamarin.Forms App
Building Your First Xamarin.Forms AppBuilding Your First Xamarin.Forms App
Building Your First Xamarin.Forms App
 
Xamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.com
Xamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.comXamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.com
Xamarin Việt Nam - Lập trình cross platform mobile app - https://uxvietnam.com
 
Building Your First Android App with Xamarin
Building Your First Android App with XamarinBuilding Your First Android App with Xamarin
Building Your First Android App with Xamarin
 
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
 

Similar a C# 4.0 and .NET 4.0

C# advanced topics and future - C#5
C# advanced topics and future - C#5C# advanced topics and future - C#5
C# advanced topics and future - C#5Peter Gfader
 
C Types - Extending Python
C Types - Extending PythonC Types - Extending Python
C Types - Extending PythonPriyank Kapadia
 
Python typing module
Python typing modulePython typing module
Python typing moduleRyan Blunden
 
Top 40 C Programming Interview Questions
Top 40 C Programming Interview QuestionsTop 40 C Programming Interview Questions
Top 40 C Programming Interview QuestionsSimplilearn
 
The Onward Journey: Porting Twisted to Python 3
The Onward Journey: Porting Twisted to Python 3The Onward Journey: Porting Twisted to Python 3
The Onward Journey: Porting Twisted to Python 3Craig Rodrigues
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentMitosis Technology
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questionsRamu Palanki
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questionsRamu Palanki
 
Can't Dance The Lambda
Can't Dance The LambdaCan't Dance The Lambda
Can't Dance The LambdaTogakangaroo
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futuresnithinmohantk
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddSrinivasa GV
 
.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep Joshi.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep JoshiSpiffy
 
Moving to Python 3
Moving to Python 3Moving to Python 3
Moving to Python 3Nick Efford
 
Behavioral Reflection
Behavioral ReflectionBehavioral Reflection
Behavioral ReflectionMarcus Denker
 

Similar a C# 4.0 and .NET 4.0 (20)

C# advanced topics and future - C#5
C# advanced topics and future - C#5C# advanced topics and future - C#5
C# advanced topics and future - C#5
 
C Types - Extending Python
C Types - Extending PythonC Types - Extending Python
C Types - Extending Python
 
Tdd in practice
Tdd in practiceTdd in practice
Tdd in practice
 
Python typing module
Python typing modulePython typing module
Python typing module
 
Top 40 C Programming Interview Questions
Top 40 C Programming Interview QuestionsTop 40 C Programming Interview Questions
Top 40 C Programming Interview Questions
 
The Onward Journey: Porting Twisted to Python 3
The Onward Journey: Porting Twisted to Python 3The Onward Journey: Porting Twisted to Python 3
The Onward Journey: Porting Twisted to Python 3
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software development
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questions
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questions
 
UNIT IV (1).ppt
UNIT IV (1).pptUNIT IV (1).ppt
UNIT IV (1).ppt
 
Can't Dance The Lambda
Can't Dance The LambdaCan't Dance The Lambda
Can't Dance The Lambda
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futures
 
Python master class 2
Python master class 2Python master class 2
Python master class 2
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tdd
 
.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep Joshi.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep Joshi
 
C+++
C+++C+++
C+++
 
Python Fundamentals Class 11
Python Fundamentals Class 11Python Fundamentals Class 11
Python Fundamentals Class 11
 
Moving to Python 3
Moving to Python 3Moving to Python 3
Moving to Python 3
 
Behavioral Reflection
Behavioral ReflectionBehavioral Reflection
Behavioral Reflection
 
SOLID principles
SOLID principlesSOLID principles
SOLID principles
 

Más de Buu Nguyen

On Becoming a Technical Lead
On Becoming a Technical LeadOn Becoming a Technical Lead
On Becoming a Technical LeadBuu Nguyen
 
Stories about KMS Technology
Stories about KMS TechnologyStories about KMS Technology
Stories about KMS TechnologyBuu Nguyen
 
Dynamic Binding in C# 4.0
Dynamic Binding in C# 4.0Dynamic Binding in C# 4.0
Dynamic Binding in C# 4.0Buu Nguyen
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0Buu Nguyen
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuu Nguyen
 
New Features of ASP.NET 4.0
New Features of ASP.NET 4.0New Features of ASP.NET 4.0
New Features of ASP.NET 4.0Buu Nguyen
 

Más de Buu Nguyen (10)

On Becoming a Technical Lead
On Becoming a Technical LeadOn Becoming a Technical Lead
On Becoming a Technical Lead
 
Stories about KMS Technology
Stories about KMS TechnologyStories about KMS Technology
Stories about KMS Technology
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
HTML5 in IE9
HTML5 in IE9HTML5 in IE9
HTML5 in IE9
 
Dynamic Binding in C# 4.0
Dynamic Binding in C# 4.0Dynamic Binding in C# 4.0
Dynamic Binding in C# 4.0
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
 
New Features of ASP.NET 4.0
New Features of ASP.NET 4.0New Features of ASP.NET 4.0
New Features of ASP.NET 4.0
 
Combres
CombresCombres
Combres
 
Fasterflect
FasterflectFasterflect
Fasterflect
 

Último

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

C# 4.0 and .NET 4.0

  • 1. C# 4.0 and .NET 4.0 Buu Nguyen, MVP (ASP.NET) www.buunguyen.net/blog buunguyen@kms-technology.com Microsoft Confidential 1
  • 2. Agenda Optional and Named Parameters Covariance and Contravariance Dynamic Binding Threading with Task API Task Parallel Library (TPL) PLINQ
  • 3. Optional and Named Parameters
  • 4. ?Quiz What are 2 issues of this API?
  • 6. ?Quiz What is wrong with this code?
  • 7. Covariance Defined Let’s say S is subtype of B and GT is a generic type GT<S> behaves like subtype of GT<B> on assignment compatibility, i.e. GT<S> s = … GT<B> b = s; GT<S> s = (GT<S>)b; Safe only when GT doesn’t expose members “receiving” T as input (aka input-safe) Microsoft Confidential 7
  • 8. ?Quiz What is wrong with this code?
  • 9. Contravariance Defined Let’s say S is subtype of B and GT is a generic type GT<B> behaves like subtype of GT<S> on assignment compatibility, i.e. GT<B> b = … GT<S> s = b; GT<B> b = (GT<B>)s; Safe only when GT doesn’t expose members “returning” T as output (aka output-safe) Microsoft Confidential 9
  • 11. ?Quiz Write a method that prints out the Name property of an anonymous object returned by another method
  • 12. Dynamic binding means… use runtime type for all bindings
  • 13. ?Quiz A method summing Length properties of all parameters, regardless of actual type
  • 14. ?Quiz How to builds C# objects that behave like JavaScript objects, i.e. members can be added at any time?
  • 15. ?Quiz Write a class whose objects can invoke static methods of any particular type Bonus #1: include non-public static methods Bonus #2: ignore case
  • 16. ?Quiz Write a class whose objects can be used as result-caching proxy for the method invocation of any other object
  • 17. Task Parallel Library (TPL) & PLINQ
  • 18. ?Quiz Write a method calculating Fibonacci number using a thread in thread-pool and returning result to caller
  • 19. Task Parallelism Features Wait on tasks Support parent-child relationship Exception handling Cancelling tasks Continuation Execute one task after another Microsoft Confidential 19
  • 20. ?Quiz Write 3 methods: Calculate some known Fibonacci numbers Calculate Fibonacci numbers for a range Calculate Fibonacci numbers for a list of specified indexes Each calculation must take place in a thread in thread-pool
  • 21. Parallel Class Assign delegates to a handful of Task instances, not one-to-one mapping
  • 22. ?Quiz Write a method which calculate some specified Fibonacci numbers and return the sum of them to the caller