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
_Maxxx_4-Nov-12 11:54
professional_Maxxx_4-Nov-12 11:54 
GeneralRe: So to really make you weep Pin
Jörgen Andersson4-Nov-12 22:54
professionalJörgen Andersson4-Nov-12 22:54 
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 
BobJanova wrote:
Depends if it's a value type, and whether Equals is overridden.

Not sure I even follow you there. An object with two boolean properties is not a value type - or am I misunderstanding you?


BobJanova wrote:
and it's usually much more useful than checking for reference equality.

I have to disagree there, and say it entirely depends on the context. If I want to check if two objects are the same object, i would like to be able to do so in a consistent manner, without having to check to see if the object is a value-type wrapper. similarly, if I want to check if the value of two objects are the same, I would expect to be able to use the same methods regardless as to whether the objects in question have booleans or Customers internally.

I reiterate - I understand exactly what is happening, and it is a trick for young players (hence the post). But I still think that there is an inherent (pun absolutely intended) discrepancy n the handling of boxed objects vs the handling of 'vanilla' objects.


BobJanova wrote:
Choosing which constructor to use based on the values of parameters, instead of the types of parameters, is a WTF all to itself.


The AIM of the method in question was was to decide on the constructor based upon the TYPES of parameter vs TYPES of arguments.

The parameters were in a collection and the arguments in another.

1. For Each parameter in the constructor it is checking
2.  For each argument in the collection
3.    If THIS ARGUMENT is already in our output collection, continue
4.    If this argument is of the same type (or subtype etc) as the current parameter, add it to the output collection
5.  Next Argument
6. Next parameter


Line 3 is where the issue arises, because if there are two value arguments, and they both have the same runtime value, then this If is triggered and the argument ignored for the 2nd and subsequent parameter.
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
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 
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 

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.