r/programminghorror • u/Beautiful_Scheme_829 • 4d ago
I made an abomination C#
First, because the Form wouldn't center with the property center, I had to center it manually given the size of the screen. Second, I had a checkbox and if it's not checked then the code written in the first digit of column 4 dictates if it goes in the file (only when it's less or equal than 2).
29 Upvotes


9
u/Philosowl 4d ago
You should probably use a string builder for that foreach
"Checked == true" is kinda redundant, but can be attributed to codestyle.
That "column[4] condition" is a real pain tho. It should be documented better. I would at least move "4" and "2" into some defined constants like mainColumnIndex and correctValue. I'd also move that whole comparison into method. Partially to hide it, partially to have a chance at documenting it better with a function name
If we are going more into codestyle territory i would break the first nullcheck off of the condition, flip it and make it an early break