Pattern matching in C# 8.0
-
Pattern matching was introduced in C# 7.0 and changed the way we look at identifying the patterns and traits of our types. The changes in C# 8.0 make this even more intuitive and improve both flexibility and readability.
"Methinks it is like a weasel"
-
Pattern matching was introduced in C# 7.0 and changed the way we look at identifying the patterns and traits of our types. The changes in C# 8.0 make this even more intuitive and improve both flexibility and readability.
"Methinks it is like a weasel"
This looks like a really useful language feature :)
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare Home | LinkedIn | Google+ | Twitter
-
Pattern matching was introduced in C# 7.0 and changed the way we look at identifying the patterns and traits of our types. The changes in C# 8.0 make this even more intuitive and improve both flexibility and readability.
"Methinks it is like a weasel"
This looks like a feature that is completely not needed and is just there to justify the jobs of people to make new features. There is nothing inherently wrong with this feature, it's just that it doesn't bring any new functionality to the language, just syntactic sugar basically.
- I would love to change the world, but they won’t give me the source code.
-
Pattern matching was introduced in C# 7.0 and changed the way we look at identifying the patterns and traits of our types. The changes in C# 8.0 make this even more intuitive and improve both flexibility and readability.
"Methinks it is like a weasel"
They're trying to make c# typeless, like other bastard languages, such as VB, and javascript... I don't like it at all.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013 -
They're trying to make c# typeless, like other bastard languages, such as VB, and javascript... I don't like it at all.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013#realJSOP wrote:
They're trying to make c# typeless, like other bastard languages, such as VB, and javascript... I don't like it at all.
I've got mixed feelings about this. Both the strong-typed and typeless concepts have their pros and cons. It's more frustrating that you cannot combine the best of both worlds into a single approach.
-
This looks like a feature that is completely not needed and is just there to justify the jobs of people to make new features. There is nothing inherently wrong with this feature, it's just that it doesn't bring any new functionality to the language, just syntactic sugar basically.
- I would love to change the world, but they won’t give me the source code.
Well, it doesn't bring new functionality but it makes some things easier to write and lets you express something that wasn't possbile before but felt it should have been there from day one. Like, for example, I always wondered why I cannot use the switch statement for type matching. Now I can, and it's a good thing. And there is some new functionality, like default interface implementations. The thing is: Introducing new features will likely require a change to the underlying runtime itself, and I like that C# was pretty conservative about that in the past until today. But, agreed, some of the syntactic sugar is already overloading the language, but at least you are not forced to use it. C++ is a really ugly language, now that C# is almost 20 years old and still readable and quite clean speaks for their designers.
-
Pattern matching was introduced in C# 7.0 and changed the way we look at identifying the patterns and traits of our types. The changes in C# 8.0 make this even more intuitive and improve both flexibility and readability.
"Methinks it is like a weasel"
I "love" articles which assert that the new version/language "reads better" when it's blindingly obvious that it doesn't.
-
Pattern matching was introduced in C# 7.0 and changed the way we look at identifying the patterns and traits of our types. The changes in C# 8.0 make this even more intuitive and improve both flexibility and readability.
"Methinks it is like a weasel"
Yeah, we know: it's hardly ever a code smell when you try to find out the concrete type of a variable instead of working with its generic type information (interface, base class). :~
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!