Click here to Skip to main content
14,384,769 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: To laugh or cry Pin
W Balboos6-May-19 6:58
mveW Balboos6-May-19 6:58 
GeneralRe: To laugh or cry Pin
Mycroft Holmes6-May-19 13:45
memberMycroft Holmes6-May-19 13:45 
GeneralRe: To laugh or cry Pin
Steven12187-May-19 12:29
professionalSteven12187-May-19 12:29 
GeneralWhen is equal not equal? Pin
honey the codewitch6-May-19 2:16
memberhoney the codewitch6-May-19 2:16 
JokeRe: When is equal not equal? Pin
Peter_in_27806-May-19 3:26
professionalPeter_in_27806-May-19 3:26 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 4:01
memberhoney the codewitch6-May-19 4:01 
GeneralRe: When is equal not equal? Pin
#realJSOP6-May-19 5:07
mve#realJSOP6-May-19 5:07 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 5:53
memberhoney the codewitch6-May-19 5:53 
it's not that it benefited from it, but my code was getting artifacts because of it.

calling string intern simply allowed me to verify the nature of the problem.

The problem is this - and it's rare, in practice, but it smacked me right between the eyes:

say i have an identifier of type *object* - yes, object

and i need to compare it with other identifiers of object.

This works as expected with object.Equals, but not with ==

The latter strictly does reference comparisons.

This introduces a weird thing with strings.

check this out

object id = "foo";

object foo = Console.ReadLine(); // type "foo" into this

if(id==(object)"foo") ;// evals to true

if(foo==(object)"foo") ;// evals to false!

if(id==foo) ;// evals to false

if(Equals(id,foo)) ;// evals to true
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

GeneralRe: When is equal not equal? Pin
#realJSOP6-May-19 6:05
mve#realJSOP6-May-19 6:05 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 6:26
memberhoney the codewitch6-May-19 6:26 
GeneralRe: When is equal not equal? Pin
harold aptroot6-May-19 7:52
memberharold aptroot6-May-19 7:52 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 8:26
memberhoney the codewitch6-May-19 8:26 
GeneralRe: When is equal not equal? Pin
Dr.Walt Fair, PE6-May-19 6:58
professionalDr.Walt Fair, PE6-May-19 6:58 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 7:44
memberhoney the codewitch6-May-19 7:44 
GeneralRe: When is equal not equal? Pin
Dr.Walt Fair, PE6-May-19 11:36
professionalDr.Walt Fair, PE6-May-19 11:36 
GeneralRe: When is equal not equal? Pin
Super Lloyd6-May-19 16:04
memberSuper Lloyd6-May-19 16:04 
GeneralRe: When is equal not equal? Pin
honey the codewitch7-May-19 3:31
memberhoney the codewitch7-May-19 3:31 
GeneralRe: When is equal not equal? Pin
englebart7-May-19 3:08
memberenglebart7-May-19 3:08 
GeneralRe: When is equal not equal? Pin
honey the codewitch7-May-19 3:30
memberhoney the codewitch7-May-19 3:30 
GeneralRe: When is equal not equal? Pin
honey the codewitch7-May-19 3:34
memberhoney the codewitch7-May-19 3:34 
GeneralWSO CCC V VI MMXIX Pin
Tim Deveaux5-May-19 21:05
memberTim Deveaux5-May-19 21:05 
GeneralRe: WSO CCC V VI MMXIX Pin
OriginalGriff5-May-19 21:22
protectorOriginalGriff5-May-19 21:22 
GeneralRe: WSO CCC V VI MMXIX - Winner Pin
Tim Deveaux5-May-19 21:32
memberTim Deveaux5-May-19 21:32 
GeneralRe: WSO CCC V VI MMXIX Pin
Johnny J.6-May-19 3:22
professionalJohnny J.6-May-19 3:22 
GeneralRe: WSO CCC V VI MMXIX Pin
OriginalGriff6-May-19 3:24
protectorOriginalGriff6-May-19 3:24 

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.