3 ms·
Nice! I can see more too. Using out parameters, these are highly discouraged. C# let's you do terrible things (including goto) but the community is pretty alig
by slackingoff2017 9y ago
Nice! I can see more too.
Using out parameters, these are highly discouraged. C# let's you do terrible things (including goto) but the community is pretty aligned that it's bad practice. In my years of doing C# I've never used one once.
Not using var anywhere. This is C# type inference 101.
Throwing "Exception" in catch with only a message. This is horrific because it throws away the original context and any stack trace. You can just say "throw" (just the one word) or rethrow the exception with an innerexception with the original info trivially. This is unforgivable, an experienced C# developer would never do this.
Extraneous uses of "this" when it's the default.
Initializing variables to null
Not using shorthand object initializers(but this is only in newer versions of C#)
Using class variables instead of properties
Using parse instead of TryParse... Like Java exception handling is an expensive stack unwind on failure, not supposed to be used for control flow.
The worst though, is how did they didn't make a method to reuse the SQL connect and data table code and instead copy pasted it around 20 times.
- MichaelGG 9y agoIf the input parsed is supposed to be well formed or isn't in a high performance area it's totally fine to use parse rather than the sorta ugly TryParse (which require using out params you just said were bad). Especially if all they're going to do is throw.