SlideShare ist ein Scribd-Unternehmen logo
1 von 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)

Weitere ähnliche Inhalte

Was ist angesagt?

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
alish sha
 
Datastructure notes
Datastructure notesDatastructure notes
Datastructure notes
Srikanth
 

Was ist angesagt? (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
 

Ähnlich wie As novidades do C# 5.0

Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
erikmsp
 
Taming Deployment With Smart Frog
Taming Deployment With Smart FrogTaming Deployment With Smart Frog
Taming Deployment With Smart Frog
Steve Loughran
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02
Wei Sun
 
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
Daniel Egan
 

Ähnlich wie 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
 

Mehr von pt_programar

Mehr von 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
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

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)