.Equals vs =

Hi all,

Just a quick one. Is there a difference between these two approaches?

bool1 = myString.Equals(“text”)
bool1 = myString = “text”

bool2 = myInt.Equals(1)
bool2 = myInt = 1

As far as I can tell, .Equals does the same thing as the = sign, but I’m not sure if it’s actually doing something else (and just always gives the same result).


Hey @adam.williamson :wave:

Read this detailed article, it should help you understand the difference:



@adam.williamson, hope you understood the difference?

I think so. I tend to always use .Equals instead of =, but wasn’t really sure if there was an underlying difference.

A bit like when copying values by reference type vs value type - one copies the value itself, and one copies a reference to the value. (I think)

1 Like

That’s right!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.