- 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.
推薦閱讀
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- 觸·心:DT時代的大數據精準營銷
- Mastering Kali Linux for Web Penetration Testing
- Linux操作系統基礎案例教程
- Couchbase Essentials
- Troubleshooting Citrix XenApp?
- Extending Unity with Editor Scripting
- 深入實踐DDD:以DSL驅動復雜軟件開發
- 零基礎學C++(升級版)
- C/C++代碼調試的藝術(第2版)
- 計算機應用基礎案例教程(第二版)
- Raspberry Pi Blueprints
- Visual FoxPro程序設計實驗教程
- INSTANT EaselJS Starter
- Oracle Database 12c DBA官方手冊(第8版)