New Features in C# 7.0 Mads Torgersen C# Program Manager

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Identity Management - Login © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Microsoft Dynamics GP 2013 R2 Dashboards © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Reprint Outstanding Transactions Report © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Purchase Order Prepayments II © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: OLE Notes Migration Utility
Feature: Web Client Keyboard Shortcuts © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Feature: Print Remaining Documents © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Suggested Item Enhancements – Sales Script and Additional Information © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: Employee Self Service Timecard Entry © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Feature: Void Historical/Open Transaction Updates © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
 Boris Jabes Program Manager Lead Microsoft Corporation TL13.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

IoCompleteRequest (Irp);... p = NULL; …f(p);
5/19/2018 1:01 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
New Features of C# Kuppurasu Nagaraj Microsoft Connect 2016
Herding Nulls and other C# stories from the future
Возможности Excel 2010, о которых следует знать
C++ Programming L3 . Control Structures kkkkkkkkkkkkkk
Title of Presentation 11/22/2018 3:34 PM
Getting Started With TypeScript
What’s new in F# 4.1 Phillip Carter Program Manager.
Digital display units This template is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION.
Intranet web banner units
Title of Presentation 12/2/2018 3:48 PM
Web Development in Visual Studio 2017
1/3/2019 1:21 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Microsoft Connect /17/2019 9:55 PM
Color Picker Kiki Saintonge PM – XAML Controls
Welcome to Azure Notebooks
Internal social media units
Azure Functions & Aurelia Serverless SPAs
2/22/2019 1:12 PM The Journey To Provision and Manage a Thousand Machine Cluster for Machine Learning Neil Sant Gat © Microsoft Corporation. All rights.
Microsoft Connect /23/ :38 AM
What’s Coming to C# William Fuqua. What’s Coming to C# William Fuqua.
Mendeleyeve Ionic Dating Services
Microsoft Connect /25/2019 1:20 PM
Microsoft Ignite NZ October 2016 SKYCITY, Auckland.
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
My Experience In Troubleshooting BIZTALK360
PENSACOLA ENERGY WORK PLAN OCTOBER 10, 2016
Title of Presentation 5/12/ :53 PM
Title of Presentation 5/24/2019 1:26 PM
5/24/2019 6:44 PM 1/8/18 Bell #10 In a world governed by the gods, is there any room for human will? Do human choices make a difference? EXPLAIN © 2007.
5/30/2019 1:59 PM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION.
Microsoft Connect /29/2019 1:53 AM
Can you work out the next shape in the pattern?
Title of Presentation 7/24/2019 8:53 PM
Power BI – The Circle is Complete
Presentation transcript:

New Features in C# 7.0 Mads Torgersen C# Program Manager

Binary literals int[] numbers = { 1, 2, 4, 8, 16, 32 }; 9/19/2018 7:11 PM Binary literals int[] numbers = { 1, 2, 4, 8, 16, 32 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Binary literals int[] numbers = { 0b1, 2, 4, 8, 16, 32 }; 9/19/2018 7:11 PM Binary literals int[] numbers = { 0b1, 2, 4, 8, 16, 32 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Binary literals int[] numbers = { 0b1, 0b10, 4, 8, 16, 32 }; 9/19/2018 7:11 PM Binary literals int[] numbers = { 0b1, 0b10, 4, 8, 16, 32 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Binary literals int[] numbers = { 0b1, 0b10, 0b100, 8, 16, 32 }; 9/19/2018 7:11 PM Binary literals int[] numbers = { 0b1, 0b10, 0b100, 8, 16, 32 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Binary literals int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 16, 32 }; 9/19/2018 7:11 PM Binary literals int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 16, 32 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Binary literals int[] numbers = 9/19/2018 7:11 PM Binary literals int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b10000, 32 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Digit separators int[] numbers = 9/19/2018 7:11 PM Digit separators int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 32 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Digit separators int[] numbers = 9/19/2018 7:11 PM Digit separators int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 3_2 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Digit separators int[] numbers = 9/19/2018 7:11 PM Digit separators int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 3_______2 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Digit separators int[] numbers = 9/19/2018 7:11 PM Digit separators int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b100000 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Digit separators int[] numbers = 9/19/2018 7:11 PM Digit separators int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var t = Tally(numbers); © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var t = Tally(numbers); (int, int) Tally(int[] values) { } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var t = Tally(numbers); (int, int) Tally(int[] values) { var r = (0, 0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var t = Tally(numbers); WriteLine($"Sum: {t.Item1}, count: {t.Item2}"); (int, int) Tally(int[] values) { var r = (0, 0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var t = Tally(numbers); WriteLine($"Sum: {t.Item1}, count: {t.Item2}"); (int sum, int count) Tally(int[] values) { var r = (0, 0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var t = Tally(numbers); WriteLine($"Sum: {t.sum}, count: {t.count}"); (int sum, int count) Tally(int[] values) { var r = (0, 0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var t = Tally(numbers); WriteLine($"Sum: {t.sum}, count: {t.count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {t.sum}, count: {t.count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); return r; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); foreach (var v in values) } return r; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); foreach (var v in values) r = (r.s + v, r.c + 1); } return r; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); foreach (var v in values) r.s += v; } return r; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9/19/2018 7:11 PM Tuples int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); foreach (var v in values) r.s += v; r.c++; } return r; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Local functions int[] numbers = 9/19/2018 7:11 PM Local functions int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); foreach (var v in values) r.s += v; r.c++; } return r; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Local functions int[] numbers = 9/19/2018 7:11 PM Local functions int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); foreach (var v in values) Add(v, 1); } return r; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Local functions int[] numbers = 9/19/2018 7:11 PM Local functions int[] numbers = { 0b1, 0b10, 0b100, 0b1000, 0b1_0000, 0b10_0000 }; var (sum, count) = Tally(numbers); WriteLine($"Sum: {sum}, count: {count}"); (int sum, int count) Tally(int[] values) { var r = (s:0, c:0); foreach (var v in values) Add(v, 1); } return r; void Add(int s, int c) { r.s += s; r.c += c; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching public void PrintStars(object o) { } 9/19/2018 7:11 PM Pattern matching public void PrintStars(object o) { } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching public void PrintStars(object o) { 9/19/2018 7:11 PM Pattern matching public void PrintStars(object o) { if (o is null) return; // constant pattern "null" } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching public void PrintStars(object o) { 9/19/2018 7:11 PM Pattern matching public void PrintStars(object o) { if (o is null) return; // constant pattern "null" if (!(o is int i)) return; // type pattern "int i" } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching public void PrintStars(object o) { 9/19/2018 7:11 PM Pattern matching public void PrintStars(object o) { if (o is null) return; // constant pattern "null" if (!(o is int i)) return; // type pattern "int i" WriteLine(new string('*', i)); } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching switch (shape) // Switch on anything { } 9/19/2018 7:11 PM Pattern matching switch (shape) // Switch on anything { } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching switch (shape) // Switch on anything { default: 9/19/2018 7:11 PM Pattern matching switch (shape) // Switch on anything { default: WriteLine("<unknown shape>"); break; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching switch (shape) // Switch on anything { case null: 9/19/2018 7:11 PM Pattern matching switch (shape) // Switch on anything { case null: throw new ArgumentNullException(nameof(shape)); default: WriteLine("<unknown shape>"); break; } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching switch (shape) // Switch on anything { 9/19/2018 7:11 PM Pattern matching switch (shape) // Switch on anything { case Circle c: // Type pattern break; case null: throw new ArgumentNullException(nameof(shape)); default: WriteLine("<unknown shape>"); } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching switch (shape) // Switch on anything { 9/19/2018 7:11 PM Pattern matching switch (shape) // Switch on anything { case Circle c: // Type pattern WriteLine($"circle with radius {c.Radius}"); // use c break; case null: throw new ArgumentNullException(nameof(shape)); default: WriteLine("<unknown shape>"); } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching switch (shape) // Switch on anything { 9/19/2018 7:11 PM Pattern matching switch (shape) // Switch on anything { case Rectangle r: WriteLine($"{r.Length} x {r.Height} rectangle"); break; case Circle c: // Type pattern WriteLine($"circle with radius {c.Radius}"); // use c case null: throw new ArgumentNullException(nameof(shape)); default: WriteLine("<unknown shape>"); } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pattern matching switch (shape) // Switch on anything { 9/19/2018 7:11 PM Pattern matching switch (shape) // Switch on anything { case Rectangle s when (s.Length == s.Height): // when-condition WriteLine($"{s.Length} x {s.Height} square"); break; case Rectangle r: WriteLine($"{r.Length} x {r.Height} rectangle"); case Circle c: // Type pattern WriteLine($"circle with radius {c.Radius}"); // use c case null: throw new ArgumentNullException(nameof(shape)); default: WriteLine("<unknown shape>"); } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

What you’ve seen Binary literals and digit separators Tuples Local functions Pattern matching More at: blogs.msdn.microsoft.com/dotnet/ 2016/08/24/whats-new-in-csharp-7-0/