How Does Pattern Matching Work in C#? #shorts

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Pattern matching is great definitely, the only downside as of now is that you can only use it with constants

shkelqimhaxha
Автор

Depends on the situation but pattern matching feels more natural.

Code_Bits
Автор

It gets interesting when it comes to refactoring of properties, but it is more readable I would say.

steffyoube
Автор

Pattern matching also has the benefit of doing null-checking, which the example above didn't could be null)

Hewtoob
Автор

Currently I'm using it and i love it ❤

KOMEK
Автор

Ummmm that's new to be. I like the pattern structure. Thanks for the video.

mohsin
Автор

One of the usage of this, I can think of is encoding constraints as a bunch of anonymous objects with descriptive names.

sif
Автор

C# looks like a mix of C++ and JavaScript (or TypeScript)

nowieszco
Автор

I'm use to the first example. The second example will need some getting use to. I don't like the ': > 3'. The : is kinda in the way for me. Can't explain it.

CRBarchager
Автор

How can you use the property as an argument for another function that checks something?

danielpmo
Автор

I find the classic way more readable. "If engineer is KnowsJava equals true and..." ...nice sentence
Classic: "If egineer KnowsJava and ..."

weluvmusicz
Автор

wait but you still use if else statement. the only difference between the two is the first using direct logical condition and the second using is and mapping?

asagiai
Автор

Readability looks about the same to me. I could see it being useful in niche cases though. But Id have to see real performance tests to be convinced of using it.

ShiloBuff
Автор

I have a love hate relationship with pattern matching

nove
Автор

What is this second comparison type? An "&& or is it an"||" type comparison?

simplesoul
Автор

i wish there was that for any.
like
if (A is Anyof { B: true, C: false, D: true })

makcings
Автор

Hi! Since wich c# version can i use that?

rafaelvaz
Автор

Is there a performance loss? Then probably not use it

Chris-dxdw
Автор

İf u dont wanna repeat engineer.
Var e = engineer;

The more u hide/ abstract sh*t . You'll confuse yourself.
Pattern matching doesn't look good for this use case.

İ wanna see some good use cases, but this isn't it.

testgandmmm