What's some C# bad practices that you know and what's the workaround?

For one mutability, as stated above. There seems to be a lackadaisical attitude towards state and it often leads to problems. Many other languages have nice paradigms to handle immutability. When the language doesn't offer good constructs to handle a scenario I feel the scenario is overlooked.

Class and function size. I know things like SOLID are growing in popularity and seem to be considered best practice for the most part but I have met a lot of C# devs who don't like having lots of small files because they think it is too hard to understand. Same with small functions, they think that too many small functions are harder to read because you have to context switch so often.

And code cleanliness in general. I guess it is unfair to say C# is the cause of this. Any of these things can be argued in any language.

I've had a lot of argument with other C# devs about things that seem to me to be generally accepted best practices even within the .NET community. That is just my experience, though. I've mainly worked with C# devs so I guess I am going to see "more bad code" on account of being exposed to more code in general.

/r/csharp Thread Parent