c# 6.0
TRANSCRIPT
![Page 1: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/1.jpg)
C# 6.0Larry Nung
![Page 2: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/2.jpg)
AGENDA
Auto-property Initializers
Using Static Members
Exception filters
Null propagation
Nameof expressions
Expression bodied members
String interpolation
Index initializers
Extension Add methods in collection initializers
Await in catch/finally
Reference
![Page 3: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/3.jpg)
AUTO-PROPERTY INITIALIZERS
![Page 4: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/4.jpg)
AUTO-PROPERTY INITIALIZERS (BEFORE)
![Page 5: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/5.jpg)
AUTO-PROPERTY INITIALIZERS (BEFORE)
![Page 6: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/6.jpg)
AUTO-PROPERTY INITIALIZERS (BEFORE)
Readonly property must
init value in variable
Initializer
![Page 7: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/7.jpg)
AUTO-PROPERTY INITIALIZERS (BEFORE)
Readonly property must
init value in variable
Initializer
![Page 8: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/8.jpg)
AUTO-PROPERTY INITIALIZERS (BEFORE)
![Page 9: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/9.jpg)
AUTO-PROPERTY INITIALIZERS (BEFORE)
Auto-property must init
value in constructor
![Page 10: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/10.jpg)
AUTO-PROPERTY INITIALIZERS (AFTER)
![Page 11: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/11.jpg)
AUTO-PROPERTY INITIALIZERS (AFTER)
Initialize value when declaration
![Page 12: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/12.jpg)
USING STATIC MEMBERS
![Page 13: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/13.jpg)
USING STATIC MEMBERS (BEFORE)
![Page 14: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/14.jpg)
USING STATIC MEMBERS (BEFORE)
![Page 15: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/15.jpg)
USING STATIC MEMBERS (AFTER)
![Page 16: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/16.jpg)
EXCEPTION FILTERS
![Page 17: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/17.jpg)
EXCEPTION FILTERS (BEFORE)
![Page 18: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/18.jpg)
EXCEPTION FILTERS (BEFORE)
Stack harmed
![Page 19: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/19.jpg)
EXCEPTION FILTERS (AFTER)
![Page 20: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/20.jpg)
EXCEPTION FILTERS (AFTER)
Stack unharmed
![Page 21: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/21.jpg)
NULL PROPAGATION
![Page 22: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/22.jpg)
NULL PROPAGATION (BEFORE)
![Page 23: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/23.jpg)
NULL PROPAGATION (BEFORE)
![Page 24: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/24.jpg)
NULL PROPAGATION (AFTER)
![Page 25: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/25.jpg)
NAMEOF EXPRESSIONS
![Page 26: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/26.jpg)
NAMEOF EXPRESSIONS (BEFORE)
![Page 27: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/27.jpg)
NAMEOF EXPRESSIONS (BEFORE)
Magic string
Is hard to maintenance
![Page 28: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/28.jpg)
NAMEOF EXPRESSIONS (AFTER)
![Page 29: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/29.jpg)
NAMEOF EXPRESSIONS (AFTER)
Translate names in
compile time
![Page 30: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/30.jpg)
EXPRESSION BODIED MEMBERS
![Page 31: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/31.jpg)
EXPRESSION BODIED MEMBERS (BEFORE)
![Page 32: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/32.jpg)
EXPRESSION BODIED MEMBERS (BEFORE)
![Page 33: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/33.jpg)
EXPRESSION BODIED MEMBERS (AFTER)
![Page 34: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/34.jpg)
EXPRESSION BODIED MEMBERS (AFTER)
May confused with
property and method
![Page 35: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/35.jpg)
STRING INTERPOLATION
![Page 36: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/36.jpg)
STRING INTERPOLATION
![Page 37: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/37.jpg)
STRING INTERPOLATION
![Page 38: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/38.jpg)
STRING INTERPOLATION
![Page 39: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/39.jpg)
INDEX INITIALIZERS
![Page 40: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/40.jpg)
INDEX INITIALIZERS (BEFORE)
Can not assign index with
object Initializer
![Page 41: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/41.jpg)
INDEX INITIALIZERS (AFTER)
Object Initializer + Index
initializer
![Page 42: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/42.jpg)
INDEX INITIALIZERS (BEFORE)
![Page 43: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/43.jpg)
INDEX INITIALIZERS (BEFORE)
With collection initializer
![Page 44: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/44.jpg)
INDEX INITIALIZERS (AFTER)
With index initializer
![Page 45: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/45.jpg)
EXTENSION ADD METHODS IN
COLLECTION INITIALIZERS
![Page 46: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/46.jpg)
EXTENSION ADD METHODS IN COLLECTION
INITIALIZERS (BEFORE)
![Page 47: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/47.jpg)
EXTENSION ADD METHODS IN COLLECTION
INITIALIZERS (AFTER)
Use extension method to
custom collection initializer
![Page 48: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/48.jpg)
AWAIT IN CATCH/FINALLY
![Page 49: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/49.jpg)
AWAIT IN CATCH/FINALLY
![Page 50: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/50.jpg)
REFERENCE
![Page 51: C# 6.0](https://reader031.vdocuments.net/reader031/viewer/2022032113/55a608181a28abed248b48a1/html5/thumbnails/51.jpg)
REFERENCE
C# 6.0 - Auto-property initializers
C# 6.0 - Using Static Members
C# 6.0 - Exception filters
C# 6.0 - Null propagation
C# 6.0 - Nameof expressions
C# 6.0 - Expression bodied members
C# 6.0 - String interpolation
C# 6.0 - Index initializers
C# 6.0 - Parameterless constructors in structs
C# 6.0 - Extension Add methods in collection
initializers