-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Enterprise Application Development with C# 10 and .NET 6 - Second Edition
By :
Pattern matching is a way to check an object's value or the value of a property having a full or partial match to a sequence. This is supported in C# in the form of if…else and switch…case statements. In modern languages, especially in functional programming languages such as F#, there is advanced support for pattern matching. With C# 7.0, new pattern matching concepts were introduced. Pattern matching provides a different way to express conditions to have more human-readable code. Pattern matching is being extended with every major release of C# since its introduction in C# 7.
In this section, let's learn about the extended property pattern introduced in C# 10.
Consider the following code snippet:
Product product = new Product
{
Name ="Men's Shirt",
Price =10.0m,
Location = new Address
{
...