SlideShare a Scribd company logo
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

PPTX
Developer’s viewpoint on swift programming language
PPT
C#3.0 & Vb 9.0 Language Enhancments
PDF
Introduction to kotlin for Java Developer
PDF
Basics of kotlin ASJ
PDF
Kotlin generics
PDF
iOS UI Component API Design
PPT
C#/.NET Little Pitfalls
PDF
iOS API Design
Developer’s viewpoint on swift programming language
C#3.0 & Vb 9.0 Language Enhancments
Introduction to kotlin for Java Developer
Basics of kotlin ASJ
Kotlin generics
iOS UI Component API Design
C#/.NET Little Pitfalls
iOS API Design

What's hot (19)

PPTX
IOS Swift language 2nd tutorial
PPTX
AST for JavaScript developers
PDF
SV-ios-objc-to-swift
PPT
Javascript by Yahoo
PPSX
Chapter 07
PPTX
C# lecture 2: Literals , Variables and Data Types in C#
PDF
PPTX
c# at f#
PPTX
JAVASCRIPT - LinkedIn
PPTX
Scope demystified - AngularJS
PPTX
IBDesignable & IBInspectible
PPTX
Getting Started With Kotlin
PDF
Doppl development iteration #5
PDF
TypeScript and Angular workshop
PPTX
Implementing the Adapter Design Pattern
PDF
ODT
Designing Better API
PPTX
Virtual function and abstract class
PDF
Akka introtalk HyScala DEC 2016
IOS Swift language 2nd tutorial
AST for JavaScript developers
SV-ios-objc-to-swift
Javascript by Yahoo
Chapter 07
C# lecture 2: Literals , Variables and Data Types in C#
c# at f#
JAVASCRIPT - LinkedIn
Scope demystified - AngularJS
IBDesignable & IBInspectible
Getting Started With Kotlin
Doppl development iteration #5
TypeScript and Angular workshop
Implementing the Adapter Design Pattern
Designing Better API
Virtual function and abstract class
Akka introtalk HyScala DEC 2016
Ad

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

DOCX
csharp.docx
PDF
C++ Training
PPTX
New features in C# 6
PDF
Before you jump into Angular
PPTX
Learn more about the concepts Functions of Python
PPTX
Web technologies-course 07.pptx
PDF
Introduction of C++ By Pawan Thakur
PPTX
Chapter3: fundamental programming
PPTX
compose 3.pptx
PDF
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
PPTX
C_plus_plus
PDF
9054799 dzone-refcard267-kotlin
PDF
2.Getting Started with C#.Net-(C#)
PDF
Absolute C++ 5th Edition Savitch Solutions Manual
PPTX
Spring framework Controllers and Annotations
PPTX
What's Coming in C# 9.0
PPTX
Inline functions & macros
PPTX
C# AND F#
PPTX
The Little Wonders of C# 6
csharp.docx
C++ Training
New features in C# 6
Before you jump into Angular
Learn more about the concepts Functions of Python
Web technologies-course 07.pptx
Introduction of C++ By Pawan Thakur
Chapter3: fundamental programming
compose 3.pptx
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
C_plus_plus
9054799 dzone-refcard267-kotlin
2.Getting Started with C#.Net-(C#)
Absolute C++ 5th Edition Savitch Solutions Manual
Spring framework Controllers and Annotations
What's Coming in C# 9.0
Inline functions & macros
C# AND F#
The Little Wonders of C# 6
Ad

More from Carlos Landeras Martínez (7)

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

Recently uploaded (20)

PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
System and Network Administraation Chapter 3
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
Digital Systems & Binary Numbers (comprehensive )
PPT
Introduction Database Management System for Course Database
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administration Chapter 2
PPTX
ai tools demonstartion for schools and inter college
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
2025 Textile ERP Trends: SAP, Odoo & Oracle
Design an Analysis of Algorithms I-SECS-1021-03
How to Migrate SBCGlobal Email to Yahoo Easily
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
wealthsignaloriginal-com-DS-text-... (1).pdf
Operating system designcfffgfgggggggvggggggggg
System and Network Administraation Chapter 3
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Designing Intelligence for the Shop Floor.pdf
top salesforce developer skills in 2025.pdf
Digital Systems & Binary Numbers (comprehensive )
Introduction Database Management System for Course Database
VVF-Customer-Presentation2025-Ver1.9.pptx
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administration Chapter 2
ai tools demonstartion for schools and inter college
Upgrade and Innovation Strategies for SAP ERP Customers

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.