Live data from Hacker News

C# Pattern Matching

docs.microsoft.com

121–130 of 214 posts

Re: C# Pattern Matching

#121
post #7

Earlier quoted context omitted.

as an aside, if you got Rider as part of your resharper subscription, try it out, it is basically a drop in replacement for visual studio but faster and with many many little quality of life improvements you never knew you needed :)

> replacement for visual studio but faster How can a IntelliJ Idea derivative written in Java be faster than VistalStudio which is native code? Both Idea and PyCharm work much slower than VisualStudio on my machine.

Rider is miles faster than visual studio for me!

Re: C# Pattern Matching

#122
I have been using F# since last year, haven't really looked back to C# since.

Unfortunately although we are a small community, it does feel like being last on Microsoft priority list.

Microsoft please listen to feedback of your F# users namely on fslang-suggestions and fslang-design repository.

My personal wish list for F# are type classes, HKTs, macros and GADTs.

Re: C# Pattern Matching

#123
post #93

Heads up for C# devs, you should switch all your code bases to use (x is null) and !(x is null) instead of ==. The is operator can't be overloaded, and always compiles to IL eq, whereas == can be overloaded in custom types. Of course it would also be nice if everything was moved to nullable reference types [0], but that's a non trivial amount of work. Note that most C#8 features can be enabled manually through the cs…

The new "something is not null" check in C#8 is "something is object/set"; for example: if (x is {})

Re: C# Pattern Matching

#124
post #117
post #84

Earlier quoted context omitted.

I have clocked in way more hours in Rider than VS. I can flawlessly run and debug our decades old monolith with 40-50 projects and millions LOC, containing C#, VB, Web Forms, WPF, files with 80k lines... And all of our .NET Core services on MacOS, with all my unix-y tooling. There is “VS for Mac”, but it’s not really VS. It’s Xamarin Studio rebranded. Rider works excellent on my Linux box at home as well, where the a…

I switched to Rider a few months ago but I still feel like I struggle with some things. For some reason I can’t change the position of the debugger when running and aspnetcore app and make it go back so I always have to re-run whatever request I happen to be debugging. Does that happen to you? It also seems like ReSharper had more tips and tricks going on when compared to Rider, but I can’t imagine that would be true…

Dragging the current line arrow back (on the left side panel by the numbers) works for me; works in VS too btw

Re: C# Pattern Matching

#125
I'm surprised at the no. of recommendations for resharper even now. I thought most of the new features of resharper was already included as part of VS2019. Any specific feature that's missing ?

Re: C# Pattern Matching

#126
post #7
post #3

Resharper has proven to be a great way for me to start learning and integrating new language features. I code in my original style and resharper suggests changes based on new features like pattern matching. At first I didnt see the benefit, but this is a hugely powerful feature once you start to wrap your mind around it.

as an aside, if you got Rider as part of your resharper subscription, try it out, it is basically a drop in replacement for visual studio but faster and with many many little quality of life improvements you never knew you needed :)

Rider has the far superior VIM plugin as well

Re: C# Pattern Matching

#127
post #93

Heads up for C# devs, you should switch all your code bases to use (x is null) and !(x is null) instead of ==. The is operator can't be overloaded, and always compiles to IL eq, whereas == can be overloaded in custom types. Of course it would also be nice if everything was moved to nullable reference types [0], but that's a non trivial amount of work. Note that most C#8 features can be enabled manually through the cs…

a number of the C# lang developers prefer (x is object) for the latter, FWIW.

Yep, looking at the IL they are equivalent. And it definitely makes code prettier due to reduced parentheses. This is also true for generics.

Doing (x != null), !(x is null), or (x is object) all become:

    ldloc.s
    ldnull
    cgt.un
    stloc.s

Re: C# Pattern Matching

#128
A new construct to save a line of code? Whatever happened to "every proposed language feature starts at -100 points, and must must become positive to even possibly be considered."?

Given that probably 90% of code is written by C or D class programmers, every new feature adds cognitive load that makes it less likely that the median programmer (who almost certainly works offshore and who likely doesn't have enough English skills to process the tutorials) will write bug-free code.

Once upon a time MS understood that highly educated university graduates are only a small percentage of the programmer market and kept that in mind.

Looking at the new language changes, that's been forgotten in order to please the programming elite.

Spare a thought for the poor souls who curse every time Microsoft adds a new blade to the Swiss Army knife of C# because they know they'll be the ones mopping up the blood of the countless programmers who've cut themselves on the new feature.

Re: C# Pattern Matching

#130

Apologies, but here's the obligatory link to my OneOf exhaustive type matching library: https://github.com/mcintyre321/OneOf

Hey I wanted to thank you! I stumbled across your repo a few years ago, when I was looking at more powerful ways to use the C# type system. I ended up pulling a heavily inspired version of your code into a utility library I made (for a zero dependency package). https://github.com/Matthew-Dove/ContainerExpressions#eithert Once again - thanks for your contribution to my learning!

[deleted]
Post reply on HN