
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:
- Si tienes ganas de ponerte al dΓa con Front End (ES6, Typescript, React, Angular, Vuejs…) te recomendamos nuestros MΓ‘ster Front End: https://lemoncode.net/master-frontend#inicio-banner
- Si te quieres poner al dΓa en Backend (stacks .net y nodejs), te aconsejamos nuestro Bootcamp Backend: https://lemoncode.net/bootcamp-backend#bootcamp-backend/banner
- Y si tienes ganas de meterte con Docker, Kubernetes, CI/CD…, tenemos nuestro Bootcamp Devops: https://lemoncode.net/bootcamp-devops#bootcamp-devops/inicio
1 comment