Buy Me A Coffee

Hi !

In the line of good features, that are also nice to read, the new use of is and is not is a huge improvement in readability.

As usual, old school validation for objects and types:

// old school
if(!(testObj is MyClass)) {...}

And now, we can type the validation with some style:

// C# 9 style
if(testObj is not MyClass) {...}

I like this new one πŸ‘†, now null / not null and other validations will be the same. With an improed readability !

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno


References


ΒΏCon ganas de ponerte al dΓ­a?

En Lemoncode te ofrecemos formaciΓ³n online impartida por profesionales que se baten el cobre en consultorΓ­a:

One response to “#Net5 – C#9 logical operators “is” and “is not” are super cool πŸ†’πŸ†’πŸ†’”

  1. […] #Net5 – C#9 logical operators β€œis” and β€œis not” are super cool πŸ†’πŸ†’πŸ†’ β€” El Bruno […]

    Liked by 1 person

Leave a comment

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading