C# difference between == and Equals()

前端 未结 17 1374
走了就别回头了
走了就别回头了 2020-11-21 06:56

I have a condition in a silverlight application that compares 2 strings, for some reason when I use == it returns false while .Equals()

17条回答
  •  醉话见心
    2020-11-21 07:56

    When we create any object there are two parts to the object one is the content and the other is reference to that content. == compares both content and reference; equals() compares only content

    http://www.codeproject.com/Articles/584128/What-is-the-difference-between-equalsequals-and-Eq

提交回复
热议问题