replaysMike / AnyDiff

A CSharp (C#) diff library that allows you to diff two objects and get a list of the differences back.
Other
164 stars 16 forks source link

Weird Output (Private fields?) #8

Closed bbakermmc closed 4 years ago

bbakermmc commented 4 years ago

Is there a way to get a list of all the properties before the compare. Im not sure where the "objectIDField" is coming from. It looks like its a private field. Is there a way to not compare the privates?

Property name: ObjectID Property type: System.String Left 110007295: 7487b8ef-575e-45d8-9f1d-5cfe86323276 Right 110006740: f046b926-da60-4654-92e1-fb0f3b2e0b11 Property name: objectIDField Property type: System.String Left 110007295: 7487b8ef-575e-45d8-9f1d-5cfe86323276 Right 110006740: f046b926-da60-4654-92e1-fb0f3b2e0b11

 private string objectIDField;
[XmlElement(IsNullable = true, Order = 6)]
    public string ObjectID
    {
      get
      {
        return this.objectIDField;
      }
      set
      {
        this.objectIDField = value;
      }
    }
corbel88 commented 4 years ago

Hi, You can use ComparisonOptions.CompareProperties to compare only properties and not the fields.

replaysMike commented 4 years ago

Closing this as @corbel88 suggested the appropriate option. If there is still an issue that needs investigation please feel free to comment and I will reopen.