Click here to Skip to main content
15,879,535 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
JokeToString() and ToUpper() are like, so cool! Pin
Nathan D Cook5-Jul-12 9:27
Nathan D Cook5-Jul-12 9:27 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
CDP18025-Jul-12 10:17
CDP18025-Jul-12 10:17 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
OriginalGriff5-Jul-12 21:03
mveOriginalGriff5-Jul-12 21:03 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
Gary R. Wheeler6-Jul-12 1:47
Gary R. Wheeler6-Jul-12 1:47 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
OriginalGriff6-Jul-12 2:47
mveOriginalGriff6-Jul-12 2:47 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
Gary R. Wheeler6-Jul-12 3:16
Gary R. Wheeler6-Jul-12 3:16 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
TNCaver10-Jul-12 5:35
TNCaver10-Jul-12 5:35 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
V.6-Jul-12 1:53
professionalV.6-Jul-12 1:53 
in addition:

1:
combo.SelectedItem might be null and thus the call to ToString() will die in a less elegant way. I don't event think the ToString to return null if selectedItem is not null. Worst case is will return the object name.

2:
Should not use mystring == null but string.isNullOrEmpty(mystring) (unless "" is allowed.)

3:
Personal, but I genuinly hate if - else if code. I prefer switch in that case. switch also allows for a fall through so you can pass on combo.SelectedItem.ToString().ToUpper() as is to the VoidPayment where it is, in this case checked again.

4:
a nice variable assignment like
    string combostringvalue = combo.SelectedItem.ToString().ToUpper() ;
would have been nice idd.
V.

GeneralRe: ToString() and ToUpper() are like, so cool! Pin
Nagy Vilmos6-Jul-12 2:21
professionalNagy Vilmos6-Jul-12 2:21 
GeneralRe: ToString() and ToUpper() are like, so cool! Pin
PIEBALDconsult6-Jul-12 3:48
mvePIEBALDconsult6-Jul-12 3:48 
Generalgot another codebase to work on... its full of surprises!!! Pin
Ankush Bansal4-Jul-12 23:45
Ankush Bansal4-Jul-12 23:45 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
OriginalGriff5-Jul-12 1:10
mveOriginalGriff5-Jul-12 1:10 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
Ankush Bansal5-Jul-12 3:28
Ankush Bansal5-Jul-12 3:28 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
Ankush Bansal5-Jul-12 3:38
Ankush Bansal5-Jul-12 3:38 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
Bernhard Hiller5-Jul-12 3:39
Bernhard Hiller5-Jul-12 3:39 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
Ankush Bansal5-Jul-12 3:41
Ankush Bansal5-Jul-12 3:41 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
Sentenryu5-Jul-12 3:46
Sentenryu5-Jul-12 3:46 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
RobCroll5-Jul-12 13:57
RobCroll5-Jul-12 13:57 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
Sentenryu6-Jul-12 0:40
Sentenryu6-Jul-12 0:40 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
RobCroll6-Jul-12 3:30
RobCroll6-Jul-12 3:30 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
BobJanova9-Jul-12 1:13
BobJanova9-Jul-12 1:13 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
RobCroll5-Jul-12 14:06
RobCroll5-Jul-12 14:06 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
OriginalGriff5-Jul-12 21:11
mveOriginalGriff5-Jul-12 21:11 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
Sentenryu6-Jul-12 0:43
Sentenryu6-Jul-12 0:43 
GeneralRe: got another codebase to work on... its full of surprises!!! Pin
OriginalGriff6-Jul-12 0:53
mveOriginalGriff6-Jul-12 0:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.