SlideShare uma empresa Scribd logo
1 de 31
NOME DA APRESENTAÇÃO
Nome (Nick no Fórum)
25 DE MAIO @MICROSOFT
What’s New In C# 5.0
Paulo Morgado (paulo.morgado)
Paulo Morgado
CodePlex
Revista
PROGRAMAR
A Language For Each Generation
# 3
The Evolution Of C#
# 4
C# 1.0 C# 2.0 C# 3.0 C# 4.0 C# 5.0
Managed Generics LINQ Dynamic Async
The Evolution Of C#
# 5
C# 1.0 C# 2.0 C# 3.0 C# 4.0 C# 5.0
Managed Generics LINQ Dynamic Async
please wait for the next slide
clicking won’t make it come any faster
DEMO
Synchronous UI Application
Introducing Async
Introducing Async - Yesterday
# 8
Click
void LoadImage()
{
// ...
LoadLocalData(...);
// ...
}
void Button_Click(...)
{
LoadImage();
UpdateView();
}
Click
Messagepump
Introducing Async - Today
# 9
Click
void LoadImage()
{
// ...
DownloadRemoteData(...);
// ...
}
void Button_Click(...)
{
LoadImage();
UpdateView();
}
Click
Messagepump
DEMO
Add the async & await keywords
Introducing Async
async void Button_Click(...)
{
await LoadImageAsync();
UpdateView();
}
async Task LoadImageAsync()
{
// ...
await DownloadRemoteDataAsync(...);
// ...
}
Messagepump
void LoadImage()
{
// ...
DownloadRemoteData(...);
// ...
}
void Button_Click(...)
{
LoadImage();
UpdateView();
}
Click
Introducing Async
# 12
Click
async Task LoadImageAsync()
{
// ...
await DownloadRemoteDataAsync(...);
// ...
}
async void Button_Click(...)
{
await LoadImageAsync();
UpdateView();
}
Click
Messagepump
Task ...
DownloadRemoteDataAsync
Task ...
LoadImageAsync
Download
LoadImage
DEMO
Async UI app: re-entrancy and deadlock
DEMO
Async with cancelation
DEMO
Async console app
DEMO
Async unit tests
Source Code Caller ID
Source Code Caller ID
• CallerFilePathAttribute
• Allows you to obtain the full path of the source file that
contains the caller. This is the file path at the time of
compile.
• http://msdn.microsoft.com/library/system.runtime.compilerservices.callerfilepathattribute.aspx
• CallerLineNumberAttribute
• Allows you to obtain the line number in the source file at
which the method is called.
• http://msdn.microsoft.com/library/system.runtime.compilerservices.callerlinenumberattribute.aspx
• CallerMemberNameAttribute
• Allows you to obtain the method or property name of the
caller to the method.
• http://msdn.microsoft.com/library/system.runtime.compilerservices.callermembernameattribute.aspx
# 18
Source Code Caller ID - Examples
# 19
static void TraceMessage(
string message,
[CallerMemberName] string memberName = "",
[CallerFilePath] string sourceFilePath = "",
[CallerLineNumber] int sourceLineNumber = 0)
{
Trace.WriteLine(
string.Format(
"{0} at {1} in {2}:line {3}",
message,
memberName,
sourceFilePath,
sourceLineNumber));
}
Source Code Caller ID - Examples
# 20
private string field;
public string Property
{
get { return this.field; }
set
{
if (this.field != value)
{
this.field = value;
this.NotifyPropertyChanged();
}
}
}
protected void NotifyPropertyChanged([CallerMemberName] string propertyName =
"")
{
// …
}
Breaking Changes
Breaking Changes
• You can use the iteration variable of a foreach statement in a lambda
expression that’s contained in the body of the loop.
• You can use the iteration variable of a foreach statement in a LINQ
expression that’s contained in the body of the loop.
• Overload resolution has been improved for calls that use named arguments
to access methods that contain params parameters.
• Overload resolution is improved for calls where the algorithm must choose
between a Func<object> parameter and a Func parameter that has a
different type parameter (e.g., string or int?) for a Func<dynamic>
argument.
• Side effects from named and positional arguments in a method call now
occur from left to right in the argument list.
http://msdn.microsoft.com/library/hh678682(v=vs.110).aspx
# 22
Resources
Resources
• C# Reference
• http://msdn.microsoft.com/library/618ayhy6.aspx
• Breaking Changes in C# 5.0
• http://msdn.microsoft.com/library/hh678682(v=vs.110).aspx
• .NET Framework 4.5
• http://msdn.microsoft.com/library/vstudio/w0x726c2(v=vs.110).aspx
• Task Parallel Library (TPL)
• http://msdn.microsoft.com/library/vstudio/dd460717.aspx
• Asynchronous Programming with Async and Await (C#
and Visual Basic)
• http://msdn.microsoft.com/library/hh191443.aspx
# 24
Resources
• Task-based Asynchronous Pattern
• http://msdn.microsoft.com/library/hh191443.aspx
• Task.Run vs Task.Factory.StartNew
• http://blogs.msdn.com/b/pfxteam/archive/2011/10/24/10229468.aspx
• An Async Premier
• http://msdn.microsoft.com/vstudio/jj573641.aspx
• Eduasync by Jon Skeet
• http://msmvps.com/blogs/jon_skeet/archive/tags/Eduasync/default.aspx
• Eric Lippert's Blog
• http://ericlippert.com/
• http://blogs.msdn.com/b/ericlippert/archive/tags/c_2300_+5-0/async/
# 25
Resources
• Lucian Wischik's Blog
• http://blogs.msdn.com/b/lucian/archive/tags/async/
• Parallel Programming Team Blog
• http://blogs.msdn.com/b/pfxteam/archive/tags/async/
• What’s new in C#5? – Red Gate
• http://www.youtube.com/watch?v=z7nry67oeKc
• Novidades Do C# 5.0 – Comunidade NetPonto
• http://www.youtube.com/watch?v=7Tl6CHf86z4
• Sample Code
• http://code.msdn.microsoft.com/C-50-AsyncAwait-Demo-
Code-334679a5
# 26
Resources
• Paulo Morgado
• @PauloMorgado
• http://PauloMorgado.NET/
• http://mvp.support.microsoft.com/profile/Paulo.Morgado
• http://msmvps.com/blogs/paulomorgado/
• http://weblogs.asp.net/paulomorgado/
• http://pontonetpt.org/blogs/paulomorgado/
• http://www.codeproject.com/Members/PauloMorgado
• http://code.msdn.microsoft.com/site/search?f%5B0%5D.Type
=User&f%5B0%5D.Value=Paulo%20Morgado
• http://www.codeplex.com/UserAccount/UserProfile.aspx?Us
erName=PauloMorgado
• http://www.slideshare.net/PauloJorgeMorgado
# 27
Q&A
Patrocinador Gold
Patrocinadores Silver
Media Partners
NOME DA APRESENTAÇÃO
Nome (Nick no Fórum)
25 DE MAIO @MICROSOFT
Thank You!
Paulo Morgado (paulo.morgado)

Mais conteúdo relacionado

Mais procurados

Ch2 C Fundamentals
Ch2 C FundamentalsCh2 C Fundamentals
Ch2 C FundamentalsSzeChingChen
 
Ch10 Program Organization
Ch10 Program OrganizationCh10 Program Organization
Ch10 Program OrganizationSzeChingChen
 
Recursive Function
Recursive FunctionRecursive Function
Recursive FunctionHarsh Pathak
 
C Programming Language Step by Step Part 1
C Programming Language Step by Step Part 1C Programming Language Step by Step Part 1
C Programming Language Step by Step Part 1Rumman Ansari
 
Chap 2 structure of c programming dti2143
Chap 2  structure of c programming dti2143Chap 2  structure of c programming dti2143
Chap 2 structure of c programming dti2143alish sha
 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c languagetanmaymodi4
 
Structure of C program
Structure of C programStructure of C program
Structure of C programPavan prasad
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c languagefarishah
 
introduction of c langauge(I unit)
introduction of c langauge(I unit)introduction of c langauge(I unit)
introduction of c langauge(I unit)Prashant Sharma
 
Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Nuzhat Memon
 
Datastructure notes
Datastructure notesDatastructure notes
Datastructure notesSrikanth
 

Mais procurados (19)

Ch2 C Fundamentals
Ch2 C FundamentalsCh2 C Fundamentals
Ch2 C Fundamentals
 
Ch10 Program Organization
Ch10 Program OrganizationCh10 Program Organization
Ch10 Program Organization
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Recursive Function
Recursive FunctionRecursive Function
Recursive Function
 
C Programming Language Step by Step Part 1
C Programming Language Step by Step Part 1C Programming Language Step by Step Part 1
C Programming Language Step by Step Part 1
 
A tutorial on C++ Programming
A tutorial on C++ ProgrammingA tutorial on C++ Programming
A tutorial on C++ Programming
 
structure of a c program
structure of a c programstructure of a c program
structure of a c program
 
C++
C++C++
C++
 
Ch9 Functions
Ch9 FunctionsCh9 Functions
Ch9 Functions
 
Chap 2 structure of c programming dti2143
Chap 2  structure of c programming dti2143Chap 2  structure of c programming dti2143
Chap 2 structure of c programming dti2143
 
C programming session7
C programming  session7C programming  session7
C programming session7
 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c language
 
C structure
C structureC structure
C structure
 
Structure of C program
Structure of C programStructure of C program
Structure of C program
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
introduction of c langauge(I unit)
introduction of c langauge(I unit)introduction of c langauge(I unit)
introduction of c langauge(I unit)
 
Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)
 
Unit iv functions
Unit  iv functionsUnit  iv functions
Unit iv functions
 
Datastructure notes
Datastructure notesDatastructure notes
Datastructure notes
 

Semelhante a As novidades do C# 5.0

Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in CSyed Mustafa
 
Compiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flatteningCompiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flatteningCAFxX
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Codeerikmsp
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersDave Bost
 
.NET Fundamentals and Business Application Development
.NET Fundamentals and Business Application Development.NET Fundamentals and Business Application Development
.NET Fundamentals and Business Application Development명신 김
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxVigneshkumar Ponnusamy
 
Functions in c
Functions in cFunctions in c
Functions in creshmy12
 
Taming Deployment With Smart Frog
Taming Deployment With Smart FrogTaming Deployment With Smart Frog
Taming Deployment With Smart FrogSteve Loughran
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial javaTpoint s
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Wei Sun
 
U19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptU19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptManivannan837728
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1  Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1 securityxploded
 

Semelhante a As novidades do C# 5.0 (20)

Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Unit-2.pptx
Unit-2.pptxUnit-2.pptx
Unit-2.pptx
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
 
Compiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flatteningCompiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flattening
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
LLVM
LLVMLLVM
LLVM
 
.NET Fundamentals and Business Application Development
.NET Fundamentals and Business Application Development.NET Fundamentals and Business Application Development
.NET Fundamentals and Business Application Development
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Taming Deployment With Smart Frog
Taming Deployment With Smart FrogTaming Deployment With Smart Frog
Taming Deployment With Smart Frog
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
Revealing C# 5
Revealing C# 5Revealing C# 5
Revealing C# 5
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02
 
U19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptU19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).ppt
 
Unit 1
Unit  1Unit  1
Unit 1
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1  Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
 

Mais de pt_programar

O desenvolvimento de aplicações móveis, antes da 1ª linha de código
O desenvolvimento de aplicações móveis, antes da 1ª linha de códigoO desenvolvimento de aplicações móveis, antes da 1ª linha de código
O desenvolvimento de aplicações móveis, antes da 1ª linha de códigopt_programar
 
Empreendedorismo em TI
Empreendedorismo em TIEmpreendedorismo em TI
Empreendedorismo em TIpt_programar
 
Conquistar o mundo com aplicações feitas à velocidade da luz
Conquistar o mundo com aplicações feitas à velocidade da luzConquistar o mundo com aplicações feitas à velocidade da luz
Conquistar o mundo com aplicações feitas à velocidade da luzpt_programar
 
DMVs - Conhece o teu SQL Server
DMVs - Conhece o teu SQL ServerDMVs - Conhece o teu SQL Server
DMVs - Conhece o teu SQL Serverpt_programar
 
Workshop web realtime
Workshop web realtimeWorkshop web realtime
Workshop web realtimept_programar
 
SEO – A importância do Search Engine Optimization
SEO – A importância do Search Engine OptimizationSEO – A importância do Search Engine Optimization
SEO – A importância do Search Engine Optimizationpt_programar
 
Novidades de Java EE 7
Novidades de Java EE 7Novidades de Java EE 7
Novidades de Java EE 7pt_programar
 
Powershell “à minha maneira”
Powershell “à minha maneira”Powershell “à minha maneira”
Powershell “à minha maneira”pt_programar
 
SQL Server – Performance e Tunning
SQL Server – Performance e TunningSQL Server – Performance e Tunning
SQL Server – Performance e Tunningpt_programar
 
Apresentação Comunidade & Evento PROGRAMAR 2013
Apresentação Comunidade & Evento PROGRAMAR 2013Apresentação Comunidade & Evento PROGRAMAR 2013
Apresentação Comunidade & Evento PROGRAMAR 2013pt_programar
 
HTML5 e CSS3 – rápido e eficaz para o presente
HTML5 e CSS3 – rápido e eficaz para o presenteHTML5 e CSS3 – rápido e eficaz para o presente
HTML5 e CSS3 – rápido e eficaz para o presentept_programar
 

Mais de pt_programar (11)

O desenvolvimento de aplicações móveis, antes da 1ª linha de código
O desenvolvimento de aplicações móveis, antes da 1ª linha de códigoO desenvolvimento de aplicações móveis, antes da 1ª linha de código
O desenvolvimento de aplicações móveis, antes da 1ª linha de código
 
Empreendedorismo em TI
Empreendedorismo em TIEmpreendedorismo em TI
Empreendedorismo em TI
 
Conquistar o mundo com aplicações feitas à velocidade da luz
Conquistar o mundo com aplicações feitas à velocidade da luzConquistar o mundo com aplicações feitas à velocidade da luz
Conquistar o mundo com aplicações feitas à velocidade da luz
 
DMVs - Conhece o teu SQL Server
DMVs - Conhece o teu SQL ServerDMVs - Conhece o teu SQL Server
DMVs - Conhece o teu SQL Server
 
Workshop web realtime
Workshop web realtimeWorkshop web realtime
Workshop web realtime
 
SEO – A importância do Search Engine Optimization
SEO – A importância do Search Engine OptimizationSEO – A importância do Search Engine Optimization
SEO – A importância do Search Engine Optimization
 
Novidades de Java EE 7
Novidades de Java EE 7Novidades de Java EE 7
Novidades de Java EE 7
 
Powershell “à minha maneira”
Powershell “à minha maneira”Powershell “à minha maneira”
Powershell “à minha maneira”
 
SQL Server – Performance e Tunning
SQL Server – Performance e TunningSQL Server – Performance e Tunning
SQL Server – Performance e Tunning
 
Apresentação Comunidade & Evento PROGRAMAR 2013
Apresentação Comunidade & Evento PROGRAMAR 2013Apresentação Comunidade & Evento PROGRAMAR 2013
Apresentação Comunidade & Evento PROGRAMAR 2013
 
HTML5 e CSS3 – rápido e eficaz para o presente
HTML5 e CSS3 – rápido e eficaz para o presenteHTML5 e CSS3 – rápido e eficaz para o presente
HTML5 e CSS3 – rápido e eficaz para o presente
 

Último

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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
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
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
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
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
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
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Último (20)

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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
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!
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
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
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
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
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

As novidades do C# 5.0

  • 1. NOME DA APRESENTAÇÃO Nome (Nick no Fórum) 25 DE MAIO @MICROSOFT What’s New In C# 5.0 Paulo Morgado (paulo.morgado)
  • 3. A Language For Each Generation # 3
  • 4. The Evolution Of C# # 4 C# 1.0 C# 2.0 C# 3.0 C# 4.0 C# 5.0 Managed Generics LINQ Dynamic Async
  • 5. The Evolution Of C# # 5 C# 1.0 C# 2.0 C# 3.0 C# 4.0 C# 5.0 Managed Generics LINQ Dynamic Async please wait for the next slide clicking won’t make it come any faster
  • 8. Introducing Async - Yesterday # 8 Click void LoadImage() { // ... LoadLocalData(...); // ... } void Button_Click(...) { LoadImage(); UpdateView(); } Click Messagepump
  • 9. Introducing Async - Today # 9 Click void LoadImage() { // ... DownloadRemoteData(...); // ... } void Button_Click(...) { LoadImage(); UpdateView(); } Click Messagepump
  • 10. DEMO Add the async & await keywords
  • 11. Introducing Async async void Button_Click(...) { await LoadImageAsync(); UpdateView(); } async Task LoadImageAsync() { // ... await DownloadRemoteDataAsync(...); // ... } Messagepump void LoadImage() { // ... DownloadRemoteData(...); // ... } void Button_Click(...) { LoadImage(); UpdateView(); } Click
  • 12. Introducing Async # 12 Click async Task LoadImageAsync() { // ... await DownloadRemoteDataAsync(...); // ... } async void Button_Click(...) { await LoadImageAsync(); UpdateView(); } Click Messagepump Task ... DownloadRemoteDataAsync Task ... LoadImageAsync Download LoadImage
  • 13. DEMO Async UI app: re-entrancy and deadlock
  • 18. Source Code Caller ID • CallerFilePathAttribute • Allows you to obtain the full path of the source file that contains the caller. This is the file path at the time of compile. • http://msdn.microsoft.com/library/system.runtime.compilerservices.callerfilepathattribute.aspx • CallerLineNumberAttribute • Allows you to obtain the line number in the source file at which the method is called. • http://msdn.microsoft.com/library/system.runtime.compilerservices.callerlinenumberattribute.aspx • CallerMemberNameAttribute • Allows you to obtain the method or property name of the caller to the method. • http://msdn.microsoft.com/library/system.runtime.compilerservices.callermembernameattribute.aspx # 18
  • 19. Source Code Caller ID - Examples # 19 static void TraceMessage( string message, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { Trace.WriteLine( string.Format( "{0} at {1} in {2}:line {3}", message, memberName, sourceFilePath, sourceLineNumber)); }
  • 20. Source Code Caller ID - Examples # 20 private string field; public string Property { get { return this.field; } set { if (this.field != value) { this.field = value; this.NotifyPropertyChanged(); } } } protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { // … }
  • 22. Breaking Changes • You can use the iteration variable of a foreach statement in a lambda expression that’s contained in the body of the loop. • You can use the iteration variable of a foreach statement in a LINQ expression that’s contained in the body of the loop. • Overload resolution has been improved for calls that use named arguments to access methods that contain params parameters. • Overload resolution is improved for calls where the algorithm must choose between a Func<object> parameter and a Func parameter that has a different type parameter (e.g., string or int?) for a Func<dynamic> argument. • Side effects from named and positional arguments in a method call now occur from left to right in the argument list. http://msdn.microsoft.com/library/hh678682(v=vs.110).aspx # 22
  • 24. Resources • C# Reference • http://msdn.microsoft.com/library/618ayhy6.aspx • Breaking Changes in C# 5.0 • http://msdn.microsoft.com/library/hh678682(v=vs.110).aspx • .NET Framework 4.5 • http://msdn.microsoft.com/library/vstudio/w0x726c2(v=vs.110).aspx • Task Parallel Library (TPL) • http://msdn.microsoft.com/library/vstudio/dd460717.aspx • Asynchronous Programming with Async and Await (C# and Visual Basic) • http://msdn.microsoft.com/library/hh191443.aspx # 24
  • 25. Resources • Task-based Asynchronous Pattern • http://msdn.microsoft.com/library/hh191443.aspx • Task.Run vs Task.Factory.StartNew • http://blogs.msdn.com/b/pfxteam/archive/2011/10/24/10229468.aspx • An Async Premier • http://msdn.microsoft.com/vstudio/jj573641.aspx • Eduasync by Jon Skeet • http://msmvps.com/blogs/jon_skeet/archive/tags/Eduasync/default.aspx • Eric Lippert's Blog • http://ericlippert.com/ • http://blogs.msdn.com/b/ericlippert/archive/tags/c_2300_+5-0/async/ # 25
  • 26. Resources • Lucian Wischik's Blog • http://blogs.msdn.com/b/lucian/archive/tags/async/ • Parallel Programming Team Blog • http://blogs.msdn.com/b/pfxteam/archive/tags/async/ • What’s new in C#5? – Red Gate • http://www.youtube.com/watch?v=z7nry67oeKc • Novidades Do C# 5.0 – Comunidade NetPonto • http://www.youtube.com/watch?v=7Tl6CHf86z4 • Sample Code • http://code.msdn.microsoft.com/C-50-AsyncAwait-Demo- Code-334679a5 # 26
  • 27. Resources • Paulo Morgado • @PauloMorgado • http://PauloMorgado.NET/ • http://mvp.support.microsoft.com/profile/Paulo.Morgado • http://msmvps.com/blogs/paulomorgado/ • http://weblogs.asp.net/paulomorgado/ • http://pontonetpt.org/blogs/paulomorgado/ • http://www.codeproject.com/Members/PauloMorgado • http://code.msdn.microsoft.com/site/search?f%5B0%5D.Type =User&f%5B0%5D.Value=Paulo%20Morgado • http://www.codeplex.com/UserAccount/UserProfile.aspx?Us erName=PauloMorgado • http://www.slideshare.net/PauloJorgeMorgado # 27
  • 28. Q&A
  • 31. NOME DA APRESENTAÇÃO Nome (Nick no Fórum) 25 DE MAIO @MICROSOFT Thank You! Paulo Morgado (paulo.morgado)