I am thinking if the diffrence is that
= = only compares the value of two strings but
a.Equals(b) by default compares the reference of both strings , but you could override this method to support value equality .
Am i correct or is there something else I should be aware of ?
Below isExtract from MSDN :Conversation on .NET
Q: Is there any difference between the DEFAULT Equals function (implemented in Object) and the =?
Anders Hejlsberg: For two reference types (classes), the default Equals() method is the same as ==. But for value types (structs), there is no == operator unless you provide an implementation in the value type.
What do you mean by"provide an implementation in the value type."
0 comments:
Post a Comment