1621061340
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
1621061340
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
1599536794
In this post, i will show you what’s new in laravel 8 version.
https://www.tutsmake.com/laravel-8-new-features-release-notes/
#laravel 8 features #laravel 8 release date #laravel 8 tutorial #news - laravel 8 new features #what's new in laravel 8 #laravel 8 release notes
1621918620
This is part 3 in a series of articles.
In the first part of this series we looked at switch expressions.
When making use of switch expressions, C## 8 also introduced the concept of property pattern matching. This enables you to match on one or more items of an object and helps to simplify multiple **if…else if **statements into a more concise form.
For example, suppose we had a CustomerOrder:
Now say we wanted to calculate a delivery cost based on what State the order is being delivered to. If the customer is a VIP member then the delivery fee may be waived depending on what the **State **is. We could write this using if…else if:
The preceding code will get bigger and harder to read the more states we add.
An alternative could be to use a switch statement to try and simplify this:
In the preceding code there is still a bit of “ceremony” with all the case blocks.
We could instead use a switch expression that makes use of property pattern matching:
Notice how the preceding code is a lot more succinct, and it’s easy to see all the cases and combinations.
What if for some States, the VIP status was not relevant for calculating delivery cost?
Suppose that the state “QE” always had a high delivery cost that never got reduced even for VIPs:
In the preceding code, if the State is “QE” then the delivery cost will be 99.99. Also notice the use of the discard _ that says “for all other combinations not listed above set the delivery cost to 5”.
#new features #icymi c# 8 #c# 8
1620873900
In the first part of this series on what was introduced in C## 8, we’re going to take a look at switch expressions.
Switch expressions allow you to write fewer lines of code when making use of switch statements. This is useful if you have a switch statement that sets/returns a value based on the input.
Prior to C## 8, the following code could be used to convert an int to its string equivalent:
#icymi #c# 8
1619194860
According to StackOverflow, C## is one of the most-loved programming languages. And I completely understand that—it is powerful, easy to learn and consistently improving and developing. It is a living language. :)
The last couple of years, there were new features added to the languages, and the new versions keep coming up—C## 7, C## 8, C## 9.
As you know, we at Progress Telerik are proud that our products are always in sync with the latest things in the .NET world, and C## 9 and JustMock are no exception.
#c #c# #c#8 #c#9