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.
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…
C# Pattern Matching
201–210 of 214 posts
Re: C# Pattern Matching
#202Earlier quoted context omitted.
> 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.
Because VS has limitations on the amount of memory it can use and although they have been working on this, there is still functionality which is highly single threaded whereas Rider tends to offload most of the functionality from the UI thread into background processes.
Re: C# Pattern Matching
#203Earlier quoted context omitted.
> 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
#204Earlier quoted context omitted.
I used VS for years before switching to Rider and honestly... just jump in, there's not much to know. If you've used ReSharper the features should seem pretty familiar.
I've actually considered it, but didn't really bring myself on doing it. How is it in general? Why do you prefer Rider?
Re: C# Pattern Matching
#205Earlier quoted context omitted.
I used VS for years before switching to Rider and honestly... just jump in, there's not much to know. If you've used ReSharper the features should seem pretty familiar.
What do you think is better in Rider? I’m using it myself for a few months now but feel like going back to VS all the time.
Re: C# Pattern Matching
#206Earlier quoted context omitted.
I worked in Scala for a while and it was pretty common to use these kind of pattern-match statements for a kind of dispatch mechanism. Not even necessarily with types, it might be something like "do one thing when field a is null and field b is not, another thing when it's the other way around, another thing when they're both null, and still another when neither is." The nice thing about it is the compiler can assert…
> do one thing when field a is null and field b is not And that would have been a good example! contrary to the one in the docs. Pattern matching for checking fields of things of the same type is a good use. Pattern matching when checking your parameters type? bad. > The nice thing about it is the compiler can assert that your match is exhaustive If you pass a new Shape object for which you forgot to implement a new…
Re: C# Pattern Matching
#207I've always seen switch statements as an anti-pattern in C#. These examples however, do demonstrate neat time saving techniques. Does anybody have examples of real-world use cases that take advantage of this that couldn't (or shouldn't) be solved in a more OO way (Visitor, Strategy, Template Method, etc)
I try to use switches only for enums or things with a 1 to 1 simple mapping. Enums to strings for example. Although even there my preference is to use an attribute on the enum.
Rust's enumerations (and others) enforce that all the enumerations are dealt with in the match (a superclass of switch, mixing metaphors).
Re: C# Pattern Matching
#208Earlier quoted context omitted.
I worked in Visual Studio full-time for many years, now I'm coding in PhpStorm (IntelliJ IDEA) since July 2019, and while overall it's really powerful, I still kind of miss VS. One notable problem I have with PhpStorm is that oftentimes when I'm trying to find files or text in files, I press the respective keyboard shortcut and start typing immediately, in WebStorm the first few letters often end up being typed into…
Windows 10 start menu is so bad I cut it out from every Windows machine I have any authority over. Try Keypirinha, it's very snappy and supports fuzzy search. https://keypirinha.com/
Re: C# Pattern Matching
#209Earlier 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.
Re: C# Pattern Matching
#210Earlier quoted context omitted.
I started using Rider recently. It's faster yes, but seems to be a bit more memory hungry out of the gate than VS+Resharper. There is one HUGE thing I miss however - the Package Manager console. There's still a few things I have to do in there and thus have to switch back to VS.
You can achieve this through nuget.exe from your hidden /.nuget directory iirc.
I can't do the equivalent of
update-package -reinstall
A forced package restore doesn't quite do the same thing. (I'm really glad Rider has that feature though!)
Add-BindingRedirect (would be extra handy since Rider doesn't handle redirects at all [1])