TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C# 9 Pattern Matching

64 pointsby benaadamsabout 4 years ago

7 comments

infogulchabout 4 years ago
I&#x27;m looking forward to Discriminated Unions being finalized. One day... <a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;csharplang&#x2F;issues&#x2F;113" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;csharplang&#x2F;issues&#x2F;113</a>
评论 #26730125 未加载
bob1029about 4 years ago
Pattern matching + switch expressions can make for really concise and functional state machines which can be validated for coverage at compile time.
评论 #26734106 未加载
spaetzleesserabout 4 years ago
I love these new additions because I like new stuff but I&#x27;ll admit it&#x27;s hard to keep up and use things with good taste. C# is becoming a BIG language similar to C++. But I guess that&#x27;s the only way to get a broad user base long term.
评论 #26728794 未加载
评论 #26728516 未加载
评论 #26728393 未加载
评论 #26728959 未加载
belinderabout 4 years ago
&gt; An interesting case is the is not null pattern. This will check whether the reference is not null. Using != null may check something different when the type overloads the != operator.<p>If it doesn&#x27;t use the != operator then what does it use? How does it work with Nullable&lt;T&gt; which relies on that
评论 #26730344 未加载
评论 #26730085 未加载
rohittidkeabout 4 years ago
i have been using C# since 2010.I find it a good language but I believe the future is not for strict statically typed languages and but for smart linters which probably could take over compilers.<p>The effort you put into strict types doesn&#x27;t deliver the returns. Languages like Typescript incmy opinion are the best as they provide optional typing and support things mixins for example which is difficult to implement in C#
The_rationalistabout 4 years ago
if (person is not null)<p>I really like it, it is more instantaneously readable than the usual != as it is more literate.
评论 #26728386 未加载
评论 #26728500 未加载
评论 #26729032 未加载
评论 #26728452 未加载
Igelauabout 4 years ago
C# has some wonderful quality of life improvements over, say, Java. I had to learn it in a rush for a job and really loved the language.<p>Unfortunately, it was the worst job ever. Abusive, corrupt environment. I found a subtle accounting glitch that no one else seemed to quite understand. Assuming good faith, I showed mathematical proof for it, and I was canned shortly thereafter. On its own, the glitch wasn&#x27;t too serious, but I suspect people were nervous that I was digging too close to something else.<p>Never bothered to set up the env at home again after that on account of the foul taste in my mouth, but that was hardly C#&#x27;s fault. Just found other things to do.
评论 #26729382 未加载