SlideShare a Scribd company logo
1 of 23
C#
6.0 & 7.0
Features
Carlos Landeras Martínez
Software Engineer at Plain Concepts
@carlos_lande
carlos.landeras@gmail.com
¿Who Am I?
A little bit of C# History
What’s What was new in C# 6.0
Read-only auto-properties
Auto-Property Initializers
Expression-bodied function members
Using Static
Null – Conditional Operators
String Interpolation
Exception filters
nameof Expressions
Await in catch and finally blocks
Index initializers
Read Only Auto Properties
Read-only auto-properties provide a more concise syntax to create immutable types, in previous C# Versions
the compiler only enforces properties not to be modified outside the class.
Read Only Auto Properties, enable true read-only behaviour, and true language support for immutable types
Note* : Read Only properties must be set inside the body of class constructor, trying to set them in other block
of code would end with a CS 0200 compilation error
Auto Property Initializers
Allows initialization of an Auto Property as part of the property declaration.
Expression bodied Function Members
The body of a lot of members that we write consist of only one statement that can be represented as an
expression
Using Static
The using static enhancement enables you to import the static methods of a single class.
Null Conditional Operator
Stop complicating your code by checking Null when accessing variables!. Yiiiiihaaaa!
String Interpolation
Welcome to the new Syntax for composing strings!
Exception filters
Determine when a given catch clause should be applied
Nameof Expression
The nameof expression evaluates to the name of a symbol
Await in catch and finally blocks
C# 6.0 allows to use await keyword y catch and finally blocks.
Index Initializers
Allow collection initialization to be more consistent. In earlier versions, we could use collection initializers
with sequence style collections, now we can even use them with Dictionaries.
What is new in C# 7.0
Expresion bodied members
Pattern Matching (Is)
Pattern Matching (Switch)
Local Functions
Inline Out variables
Returns by reference
Throw expressions
Tuples
Deconstructions
Async return types (ValueTask)
Expression bodied members
In C# 6.0 we had expression bodied function members, and this version has added accessors, constructors
and finalizers
Pattern Matching (is)
Syntactic elements that can test that a value has a certain “shape”, and extract information from the value
when it does.
Pattern Matching (Switch)
You can now switch on any type, not just primitive types.
Patterns can use case clauses, and this clauses can have additional conditions on them.
Local functions
If your helper function only makes sense inside the single method that is consuming it. You can now
declare it as a local function.
Inline out variables
Before C# 6.0, you had to declare variables you pass to out parameters, it is a little bit pointless since this
value will be overwritten. In C# 7.0 you can declare and use them inline.
Throw expressions
It is now possible to throw an exception in the middle of an expression ;)
Tuples and deconstructions
Tuples have arrived to C# 7.0!. You can stop creating dummy objects to return more than one value. The
options until now were:
• System.Tuple (Verbose and require allocation)
• Out parameters (Use is awkward, not working in async methods)
• Anonymous types through a dynamic. (overhead and no type checking)
Tuples are a new value type in C# language. This means Performance (no overhead like old Tuple, that
stored a class instance) and new software design capabilities.
Async return types
C# 7.0 introduces ValueTask. The main advantage of this new struct, it’s to prevent the Allocation of a new
Task<T> object in cases where the result of the async operation is already available at the time of awaiting.

More Related Content

What's hot

What's hot (19)

IOS Swift language 2nd tutorial
IOS Swift language 2nd tutorialIOS Swift language 2nd tutorial
IOS Swift language 2nd tutorial
 
AST for JavaScript developers
AST for JavaScript developersAST for JavaScript developers
AST for JavaScript developers
 
SV-ios-objc-to-swift
SV-ios-objc-to-swiftSV-ios-objc-to-swift
SV-ios-objc-to-swift
 
Javascript by Yahoo
Javascript by YahooJavascript by Yahoo
Javascript by Yahoo
 
Chapter 07
Chapter 07 Chapter 07
Chapter 07
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
 
Unit 2.5
Unit 2.5Unit 2.5
Unit 2.5
 
c# at f#
c# at f#c# at f#
c# at f#
 
JAVASCRIPT - LinkedIn
JAVASCRIPT - LinkedInJAVASCRIPT - LinkedIn
JAVASCRIPT - LinkedIn
 
Scope demystified - AngularJS
Scope demystified - AngularJSScope demystified - AngularJS
Scope demystified - AngularJS
 
IBDesignable & IBInspectible
IBDesignable & IBInspectibleIBDesignable & IBInspectible
IBDesignable & IBInspectible
 
Getting Started With Kotlin
Getting Started With KotlinGetting Started With Kotlin
Getting Started With Kotlin
 
Doppl development iteration #5
Doppl development   iteration #5Doppl development   iteration #5
Doppl development iteration #5
 
TypeScript and Angular workshop
TypeScript and Angular workshopTypeScript and Angular workshop
TypeScript and Angular workshop
 
Implementing the Adapter Design Pattern
Implementing the Adapter Design PatternImplementing the Adapter Design Pattern
Implementing the Adapter Design Pattern
 
Iq rails
Iq railsIq rails
Iq rails
 
Designing Better API
Designing Better APIDesigning Better API
Designing Better API
 
Virtual function and abstract class
Virtual function and abstract classVirtual function and abstract class
Virtual function and abstract class
 
Akka introtalk HyScala DEC 2016
Akka introtalk HyScala DEC 2016Akka introtalk HyScala DEC 2016
Akka introtalk HyScala DEC 2016
 

Similar to C# 6.0 and 7.0 new features

Similar to C# 6.0 and 7.0 new features (20)

csharp.docx
csharp.docxcsharp.docx
csharp.docx
 
C++ Training
C++ TrainingC++ Training
C++ Training
 
New features in C# 6
New features in C# 6New features in C# 6
New features in C# 6
 
Before you jump into Angular
Before you jump into AngularBefore you jump into Angular
Before you jump into Angular
 
Web technologies-course 07.pptx
Web technologies-course 07.pptxWeb technologies-course 07.pptx
Web technologies-course 07.pptx
 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
 
compose 3.pptx
compose 3.pptxcompose 3.pptx
compose 3.pptx
 
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
 
C_plus_plus
C_plus_plusC_plus_plus
C_plus_plus
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
9054799 dzone-refcard267-kotlin
9054799 dzone-refcard267-kotlin9054799 dzone-refcard267-kotlin
9054799 dzone-refcard267-kotlin
 
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#)
 
Spring framework Controllers and Annotations
Spring framework   Controllers and AnnotationsSpring framework   Controllers and Annotations
Spring framework Controllers and Annotations
 
What's Coming in C# 9.0
What's Coming in C# 9.0What's Coming in C# 9.0
What's Coming in C# 9.0
 
Inline functions & macros
Inline functions & macrosInline functions & macros
Inline functions & macros
 
C# AND F#
C# AND F#C# AND F#
C# AND F#
 
The Little Wonders of C# 6
The Little Wonders of C# 6The Little Wonders of C# 6
The Little Wonders of C# 6
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
 
Dot net programming concept
Dot net  programming conceptDot net  programming concept
Dot net programming concept
 

More from Carlos Landeras Martínez

Dotnet2019 Asp .Net Core Good Practices 2019
Dotnet2019 Asp .Net Core Good Practices 2019Dotnet2019 Asp .Net Core Good Practices 2019
Dotnet2019 Asp .Net Core Good Practices 2019Carlos Landeras Martínez
 
Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...
Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...
Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...Carlos Landeras Martínez
 
.Net Core Real time App on My Rasperry PI - Codemotion 2017 talk
.Net Core Real time App on My Rasperry PI - Codemotion 2017 talk.Net Core Real time App on My Rasperry PI - Codemotion 2017 talk
.Net Core Real time App on My Rasperry PI - Codemotion 2017 talkCarlos Landeras Martínez
 
Plainconcepts .Net Core Event - Real Time Applications
Plainconcepts .Net Core Event - Real Time ApplicationsPlainconcepts .Net Core Event - Real Time Applications
Plainconcepts .Net Core Event - Real Time ApplicationsCarlos Landeras Martínez
 
Machine learning for dummies - Azuges November 2016
Machine learning for dummies - Azuges November 2016Machine learning for dummies - Azuges November 2016
Machine learning for dummies - Azuges November 2016Carlos Landeras Martínez
 

More from Carlos Landeras Martínez (7)

Dotnet2019 Asp .Net Core Good Practices 2019
Dotnet2019 Asp .Net Core Good Practices 2019Dotnet2019 Asp .Net Core Good Practices 2019
Dotnet2019 Asp .Net Core Good Practices 2019
 
Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...
Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...
Carlos Landeras - Tech Summit - Aplicaciones corporativas descentralizadas co...
 
SignalR is coming talk slides
SignalR is coming talk slidesSignalR is coming talk slides
SignalR is coming talk slides
 
Plain concepts webday- Carlos Landeras
Plain concepts webday- Carlos LanderasPlain concepts webday- Carlos Landeras
Plain concepts webday- Carlos Landeras
 
.Net Core Real time App on My Rasperry PI - Codemotion 2017 talk
.Net Core Real time App on My Rasperry PI - Codemotion 2017 talk.Net Core Real time App on My Rasperry PI - Codemotion 2017 talk
.Net Core Real time App on My Rasperry PI - Codemotion 2017 talk
 
Plainconcepts .Net Core Event - Real Time Applications
Plainconcepts .Net Core Event - Real Time ApplicationsPlainconcepts .Net Core Event - Real Time Applications
Plainconcepts .Net Core Event - Real Time Applications
 
Machine learning for dummies - Azuges November 2016
Machine learning for dummies - Azuges November 2016Machine learning for dummies - Azuges November 2016
Machine learning for dummies - Azuges November 2016
 

Recently uploaded

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Recently uploaded (20)

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

C# 6.0 and 7.0 new features

  • 2. Carlos Landeras Martínez Software Engineer at Plain Concepts @carlos_lande carlos.landeras@gmail.com ¿Who Am I?
  • 3. A little bit of C# History
  • 4. What’s What was new in C# 6.0 Read-only auto-properties Auto-Property Initializers Expression-bodied function members Using Static Null – Conditional Operators String Interpolation Exception filters nameof Expressions Await in catch and finally blocks Index initializers
  • 5. Read Only Auto Properties Read-only auto-properties provide a more concise syntax to create immutable types, in previous C# Versions the compiler only enforces properties not to be modified outside the class. Read Only Auto Properties, enable true read-only behaviour, and true language support for immutable types Note* : Read Only properties must be set inside the body of class constructor, trying to set them in other block of code would end with a CS 0200 compilation error
  • 6. Auto Property Initializers Allows initialization of an Auto Property as part of the property declaration.
  • 7. Expression bodied Function Members The body of a lot of members that we write consist of only one statement that can be represented as an expression
  • 8. Using Static The using static enhancement enables you to import the static methods of a single class.
  • 9. Null Conditional Operator Stop complicating your code by checking Null when accessing variables!. Yiiiiihaaaa!
  • 10. String Interpolation Welcome to the new Syntax for composing strings!
  • 11. Exception filters Determine when a given catch clause should be applied
  • 12. Nameof Expression The nameof expression evaluates to the name of a symbol
  • 13. Await in catch and finally blocks C# 6.0 allows to use await keyword y catch and finally blocks.
  • 14. Index Initializers Allow collection initialization to be more consistent. In earlier versions, we could use collection initializers with sequence style collections, now we can even use them with Dictionaries.
  • 15. What is new in C# 7.0 Expresion bodied members Pattern Matching (Is) Pattern Matching (Switch) Local Functions Inline Out variables Returns by reference Throw expressions Tuples Deconstructions Async return types (ValueTask)
  • 16. Expression bodied members In C# 6.0 we had expression bodied function members, and this version has added accessors, constructors and finalizers
  • 17. Pattern Matching (is) Syntactic elements that can test that a value has a certain “shape”, and extract information from the value when it does.
  • 18. Pattern Matching (Switch) You can now switch on any type, not just primitive types. Patterns can use case clauses, and this clauses can have additional conditions on them.
  • 19. Local functions If your helper function only makes sense inside the single method that is consuming it. You can now declare it as a local function.
  • 20. Inline out variables Before C# 6.0, you had to declare variables you pass to out parameters, it is a little bit pointless since this value will be overwritten. In C# 7.0 you can declare and use them inline.
  • 21. Throw expressions It is now possible to throw an exception in the middle of an expression ;)
  • 22. Tuples and deconstructions Tuples have arrived to C# 7.0!. You can stop creating dummy objects to return more than one value. The options until now were: • System.Tuple (Verbose and require allocation) • Out parameters (Use is awkward, not working in async methods) • Anonymous types through a dynamic. (overhead and no type checking) Tuples are a new value type in C# language. This means Performance (no overhead like old Tuple, that stored a class instance) and new software design capabilities.
  • 23. Async return types C# 7.0 introduces ValueTask. The main advantage of this new struct, it’s to prevent the Allocation of a new Task<T> object in cases where the result of the async operation is already available at the time of awaiting.