Earlier quoted context omitted.
Every single feature C# got in past years increased my productivity. I understand that it may cause issues to new learners, but overall, what of them do you consider bloat?
Wait till you get to work in some complex code bases and you'll understand why jamming all kinds of idioms into one language can become a disaster. It's a tool after all, if you know how to use it properly you don't paint yourself into a corner. However, too much flexibility can lead to many problems in larger teams. Good luck!
C# Pattern Matching
151–160 of 214 posts
Re: C# Pattern Matching
#152Earlier 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 :)
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.
Re: C# Pattern Matching
#153Heads 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…
That's exactly the reason to use the opposite. In certain C# environments (like Unity game engine) the == is overloaded in a very meaningful way (when C# objects are used as representations of unmanaged objects, and they appear to "equal null" if the represented object is no longer available in the system), and using methods other than == to compare to null (such as casting to boolean) can introduce hard to detect bugs.
Re: C# Pattern Matching
#154Earlier 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.
Visual Studio has been unable to keep up with my (not notably fast) typing since like 2005. Rider has no issue. Nor does IntelliJ or CLion or Goland.
A similar thing makes me go nuts in Windows as well - in Windows 7 I pressed the WinKey and started typing immediately to find an application, never had a problem, but Windows 10 often misses the first few keystrokes after the Start menu opens. I can't believe this hasn't been fixed for years.
--
EDIT: fixed a typo
Re: C# Pattern Matching
#155I'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)
Why are switches an anti-pattern? Switching a simple switch with a strategy pattern can make code far more complex and hard to understand. Switches are simple to code, simple to read, and easy to change.
Re: C# Pattern Matching
#156Java is getting tuples, PHP is getting union types, C# is getting pattern matching... someone is going to announce algebraic data types and I'll die. Nice work, C#!
Re: C# Pattern Matching
#157Earlier 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
#158Earlier quoted context omitted.
I don't know, what's easier to understand? Sorting a list with an IComparer instance that you have to implement in a concrete data type somewhere, or just tossing it a lambda expression? Just because it's new syntax doesn't mean it's automatically more difficult to understand the language.
I got nothing against functional programming, I embrace it. However, im stating again, shoving everything under one umbrella is bound to create a complex monster. Functional programming is actually easier to understand in F# rather than C#, the idioms do translate but clunkily. Do yourseves a favor and spend some time outside C# and you’ll come back illuminated. Not saying C# is bad, thats what you all seem to unders…
Your comments are extremely condescending.
Re: C# Pattern Matching
#159Earlier quoted context omitted.
Visual Studio has been unable to keep up with my (not notably fast) typing since like 2005. Rider has no issue. Nor does IntelliJ or CLion or Goland.
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…
Re: C# Pattern Matching
#160Heads 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.