Link to home
Start Free TrialLog in
Avatar of j_tipps
j_tipps

asked on

if (string = string) error converting string to bool

I'm from a vb.net back ground and not sure how to compaire two string values in a if statement.
I know that in c# that if statements always return a boolen value and thats fine but i just want to make sure two string have the save value.
ASKER CERTIFIED SOLUTION
Avatar of Rodney Helsens
Rodney Helsens

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of j_tipps
j_tipps

ASKER

oo crap that was it, thanks man
in C#? Remember strings are objects. You can type:

    if( myStr1.Equals( myStr2 ) ) { ... }

Which I believe is exactly the same

    if( myStr1 == myStr2 ) { ... }

but clear in the sense that you are asking the myStr1 object to tell you whether myStr2 represents the same object.

This works for any object, not just strings.

Dave
Avatar of j_tipps

ASKER

ya thansk for the 411 Dave!