Click here to Skip to main content
15,887,027 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.

 
GeneralRe: So to really make you weep Pin
Stefan_Lang5-Nov-12 1:33
Stefan_Lang5-Nov-12 1:33 
GeneralRe: So to really make you weep Pin
Jörgen Andersson5-Nov-12 1:38
professionalJörgen Andersson5-Nov-12 1:38 
GeneralRe: So to really make you weep Pin
Stefan_Lang5-Nov-12 2:03
Stefan_Lang5-Nov-12 2:03 
GeneralRe: So to really make you weep Pin
Jörgen Andersson5-Nov-12 2:10
professionalJörgen Andersson5-Nov-12 2:10 
GeneralRe: Trick for young players. Pin
BobJanova2-Nov-12 0:47
BobJanova2-Nov-12 0:47 
GeneralRe: Trick for young players. Pin
_Maxxx_2-Nov-12 1:15
professional_Maxxx_2-Nov-12 1:15 
GeneralRe: Trick for young players. Pin
BobJanova2-Nov-12 1:46
BobJanova2-Nov-12 1:46 
GeneralRe: Trick for young players. Pin
_Maxxx_2-Nov-12 2:01
professional_Maxxx_2-Nov-12 2:01 
BobJanova wrote:
Then why is it using the values?


It's not. It's using contains in an attempt to determine if the collection contains the object it is looking at. As it turns out, a (very small minority) of the objects are boxed value types, and an even smaller number of these have the same value, and so 'break' the code. The fact that Contains uses the values rather than comparing object references is exactly the cause of confusion. Asking why is it using values is like asking someone who has accidentally shot off their toe "why did you fire the gun at your foot?"


BobJanova wrote:
Capital letters don't change what you are actually coding

Actually they do in C#, which is case sensitive ')

BobJanova wrote:
(or what your pseudo-code does).


The capitals were there for emphasis and to help understand which bits I was TALKING about


BobJanova wrote:
Line 3 is where the issue arises because you shouldn't be doing that;


No sh*t, Sherlock? I know that is the bit that's causing the problem.

BobJanova wrote:
the value of an argument is irrelevant to the parameter matching to find a method.


Yes - and as I said, the AIM of the code was to check for the presence of the argument, not its value.

I capitalised there for emphasis
MVVM# - See how I did MVVM my way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011

.\\axxx
(That's an 'M')

GeneralRe: Trick for young players. Pin
Harley L. Pebley2-Nov-12 6:18
Harley L. Pebley2-Nov-12 6:18 
GeneralRe: Trick for young players. Pin
_Maxxx_4-Nov-12 11:56
professional_Maxxx_4-Nov-12 11:56 
GeneralRe: Trick for young players. Pin
Sentenryu1-Nov-12 5:47
Sentenryu1-Nov-12 5:47 
GeneralRe: Trick for young players. Pin
twizzle8011-Nov-12 19:32
twizzle8011-Nov-12 19:32 
GeneralRe: Trick for young players. Pin
_Maxxx_2-Nov-12 0:07
professional_Maxxx_2-Nov-12 0:07 
GeneralRe: Trick for young players. Pin
BobJanova2-Nov-12 0:50
BobJanova2-Nov-12 0:50 
GeneralRe: Trick for young players. Pin
harold aptroot2-Nov-12 0:25
harold aptroot2-Nov-12 0:25 
GeneralRe: Trick for young players. Pin
englebart2-Nov-12 2:54
professionalenglebart2-Nov-12 2:54 
GeneralRe: Trick for young players. Pin
_Maxxx_4-Nov-12 11:49
professional_Maxxx_4-Nov-12 11:49 
GeneralRe: Trick for young players. Pin
CafedeJamaica2-Nov-12 10:54
professionalCafedeJamaica2-Nov-12 10:54 
GeneralRe: Trick for young players. Pin
AspDotNetDev2-Nov-12 11:28
protectorAspDotNetDev2-Nov-12 11:28 
GeneralRe: Trick for young players. Pin
BotReject4-Nov-12 10:54
BotReject4-Nov-12 10:54 
GeneralRe: Trick for young players. Pin
TheCoolCoder5-Nov-12 1:13
TheCoolCoder5-Nov-12 1:13 
GeneralRe: Trick for young players. Pin
_Maxxx_5-Nov-12 1:40
professional_Maxxx_5-Nov-12 1:40 
GeneralRe: Trick for young players. Pin
Super Lloyd5-Nov-12 17:47
Super Lloyd5-Nov-12 17:47 
GeneralRe: Trick for young players. Pin
_Maxxx_5-Nov-12 22:25
professional_Maxxx_5-Nov-12 22:25 
GeneralSomebody getting paid by the character typed? Pin
esaulsberry29-Oct-12 10:17
esaulsberry29-Oct-12 10:17 

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.