Comparing two instances of a class

后端 未结 8 784
礼貌的吻别
礼貌的吻别 2020-12-03 17:33

I have a class like this

public class TestData
{
   public string Name {get;set;}
   public string type {get;set;}

   public List Members = ne         


        
8条回答
  •  天涯浪人
    2020-12-03 18:23

    First of all equality is difficult to define and only you can define as to what equality means for you

    1. Does it means members have same value
    2. Or they are pointing to same location.

    Here is a discussion and an answer here

    What is "Best Practice" For Comparing Two Instances of a Reference Type?

提交回复
热议问题