- C# 7 and .NET Core Cookbook
- Dirk Strauss
- 115字
- 2021-07-03 00:11:51
Pattern matching
C# 7.0 introduces an aspect common to functional programming languages with pattern matching. This new kind of construct can test values in different ways. To accomplish this, two language constructs in C# 7.0 have been enhanced to take advantage of patterns. These are as follows:
- The is expression
- The case clause in switch statements
With regard to the is expression, developers can now have a pattern on the right instead of just a type. When it comes to switch statements, the case clause can now match on patterns. The switch statement is no longer limited to primitive types and can switch on anything. Let's start by looking at the is expression.
推薦閱讀
- Software Testing using Visual Studio 2012
- JavaFX Essentials
- Android 9 Development Cookbook(Third Edition)
- SQL基礎教程(視頻教學版)
- Python Data Analysis Cookbook
- AIRIOT物聯網平臺開發框架應用與實戰
- 西門子S7-200 SMART PLC編程從入門到實踐
- 持續輕量級Java EE開發:編寫可測試的代碼
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- Go語言開發實戰(慕課版)
- 分布式架構原理與實踐
- 軟件測試技術
- Elasticsearch搜索引擎構建入門與實戰
- 一覽眾山小:ASP.NET Web開發修行實錄
- Hadoop Blueprints