DEV Community

Zohar Peled
Zohar Peled

Posted on • Originally published at zoharpeled.wordpress.com

3 2

c#9 is finally here (this is not about init-only or records)

c# 9 and .Net 5 are finally officially released, and everybody blogs about init-only properties and records - which are very exciting and long-awaited features that I'm sure will be used a lot and contribute a lot to code quality.

However, I would like to address another great thing about c# 9 that I didn't see a lot of bloggers excited about - and that is the improvements of pattern matching. Specifically, the adding of the not keyword - as it relates to an older post I've published almost exactly a year ago:


In c# 9, We finally actually do have the perfect non-null test, and it's way better than x is object because it's much, much more readable:
if(x is not null) { /* No explanation needed... */ }
Enter fullscreen mode Exit fullscreen mode

See when I first started using x is object in my code, My team leader have complained that it's less readable than the x != null we had all over our code base. I actually had to convince him that this is a better option. With the c#9 new syntax, anyone reading the code that has even minimal knowledge of c# and the English language can instantly understand it - which finally, makes it truly the perfect non-null test.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (1)

Collapse
 
maulinshah1015 profile image
maulinshah1015

Like

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more