Click here to Skip to main content
15,923,120 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 Balboos, GHB6-May-19 5:58
W Balboos, GHB6-May-19 5:58 
GeneralRe: To laugh or cry Pin
Mycroft Holmes6-May-19 12:45
professionalMycroft Holmes6-May-19 12:45 
GeneralRe: To laugh or cry Pin
Steven12187-May-19 11:29
professionalSteven12187-May-19 11:29 
GeneralWhen is equal not equal? Pin
honey the codewitch6-May-19 1:16
mvahoney the codewitch6-May-19 1:16 
JokeRe: When is equal not equal? Pin
Peter_in_27806-May-19 2:26
professionalPeter_in_27806-May-19 2:26 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 3:01
mvahoney the codewitch6-May-19 3:01 
GeneralRe: When is equal not equal? Pin
#realJSOP6-May-19 4:07
professional#realJSOP6-May-19 4:07 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 4:53
mvahoney the codewitch6-May-19 4: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 5:05
professional#realJSOP6-May-19 5:05 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 5:26
mvahoney the codewitch6-May-19 5:26 
GeneralRe: When is equal not equal? Pin
harold aptroot6-May-19 6:52
harold aptroot6-May-19 6:52 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 7:26
mvahoney the codewitch6-May-19 7:26 
GeneralRe: When is equal not equal? Pin
Dr.Walt Fair, PE6-May-19 5:58
professionalDr.Walt Fair, PE6-May-19 5:58 
GeneralRe: When is equal not equal? Pin
honey the codewitch6-May-19 6:44
mvahoney the codewitch6-May-19 6:44 
GeneralRe: When is equal not equal? Pin
Dr.Walt Fair, PE6-May-19 10:36
professionalDr.Walt Fair, PE6-May-19 10:36 
GeneralRe: When is equal not equal? Pin
Super Lloyd6-May-19 15:04
Super Lloyd6-May-19 15:04 
GeneralRe: When is equal not equal? Pin
honey the codewitch7-May-19 2:31
mvahoney the codewitch7-May-19 2:31 
GeneralRe: When is equal not equal? Pin
englebart7-May-19 2:08
professionalenglebart7-May-19 2:08 
GeneralRe: When is equal not equal? Pin
honey the codewitch7-May-19 2:30
mvahoney the codewitch7-May-19 2:30 
GeneralRe: When is equal not equal? Pin
honey the codewitch7-May-19 2:34
mvahoney the codewitch7-May-19 2:34 
GeneralWSO CCC V VI MMXIX Pin
Tim Deveaux5-May-19 20:05
Tim Deveaux5-May-19 20:05 
GeneralRe: WSO CCC V VI MMXIX Pin
OriginalGriff5-May-19 20:22
mveOriginalGriff5-May-19 20:22 
GeneralRe: WSO CCC V VI MMXIX - Winner Pin
Tim Deveaux5-May-19 20:32
Tim Deveaux5-May-19 20:32 
GeneralRe: WSO CCC V VI MMXIX Pin
Johnny J.6-May-19 2:22
professionalJohnny J.6-May-19 2:22 
GeneralRe: WSO CCC V VI MMXIX Pin
OriginalGriff6-May-19 2:24
mveOriginalGriff6-May-19 2: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.