- 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.
推薦閱讀
- Fundamentals of Linux
- Django:Web Development with Python
- C語言程序設計立體化案例教程
- Java Web開發技術教程
- Hands-On Microservices with Kotlin
- 用戶體驗增長:數字化·智能化·綠色化
- Arduino家居安全系統構建實戰
- Building Android UIs with Custom Views
- 匯編語言編程基礎:基于LoongArch
- Learning Docker Networking
- Modern C++ Programming Cookbook
- Laravel Application Development Blueprints
- C/C++程序設計教程
- VMware vRealize Orchestrator Essentials
- Learning Rust