This is part 4 in a series of articles.
In this series we’ve already covered switch expressions and one little-known feature is the ability to nest switch expressions.
Suppose we have the following 3 classes:
(Notice that none of the preceding classes are linked by inheritance.)
Suppose we wanted to run a gift card promotional mailing depending on what accounts customers had. We can use pattern matching on the type of object in a switch expression:
#icymi #c# #c# 8