Categories

Dec 8, 2019 in Dot Net
Q: Pattern matching in C#

1 Answer

Dec 8, 2019

Pattern matching gives tools to provide shape-dependent functionality across related but different kinds of data. C# 7.0 introduced syntax for type patterns and constant patterns by using the is expression and the switch statement. These features represented the first tentative steps toward supporting programming paradigms where data and functionality live apart. As the industry moves toward more microservices and other cloud-based architectures, other language tools are needed.

C# 8.0 expands this vocabulary so you can use more pattern expressions in more places in your code. Consider these features when your data and functionality are separate. Consider pattern matching when your algorithms depend on a fact other than the runtime type of an object. These techniques provide another way to express designs.

In addition to new patterns in new places, C# 8.0 adds recursive patterns. The result of any pattern expression is an expression. A recursive pattern is simply a pattern expression applied to the output of another pattern expression.

Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

Madanswer
Dec 8, 2019 in Dot Net
Dec 8, 2019 in Dot Net
Dec 8, 2019 in Dot Net
...