Click here to Skip to main content
15,887,343 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
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 
GeneralRe: Trick for young players. Pin
BobJanova2-Nov-12 1:46
BobJanova2-Nov-12 1:46 
_Maxxx_ wrote:
An object with two boolean properties is not a value type

Depends whether you want it to be.

struct MyType { public bool a, b; } // value type
class MyType { public bool a, b; } // reference type


_Maxxx_ wrote:
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

You can. ReferenceEquals and ==/Equals respectively. Contains is defined to use Equals not ReferenceEquals because that's almost always what you want when there is a difference.


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

Then why is it using the values? Capital letters don't change what you are actually coding (or what your pseudo-code does). Line 3 is where the issue arises because you shouldn't be doing that; the value of an argument is irrelevant to the parameter matching to find a method.
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 
GeneralRe: Trick for young players. Pin
_Maxxx_5-Nov-12 22:25
professional_Maxxx_5-Nov-12 22:25 

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.