I have the watches with the values written below and a property with the accessors written below. Although the values are boxed strings and their types are the same, and the actual text in the strings is exactly the same, the condition d.Value.Value != d.Value.DefaultValue
is true
.
I have put the watches below and I was simply surprised by their values.
internal object DefaultValue { get; set; } = null;
internal object _Value = null;
internal object Value
{
get
{
return _Value;
}
set
{
if (_Value != value)
{
_Value = value;
Changed?.Invoke(this, new SettingValueChangedEventArgs()
{
IsInitialization = FirstChangeIsInitialization
});
}
}
}
Watches values when the breakpoint on _Value != value
was hit:
d.Value.Value != d.Value.DefaultValue
: trued.Value.Value
: "None" (object {string})d.Value.DefaultValue
: "None" (object {string})"test"
: "test" (string)((object)"test").GetType()
: object {string}d.Value.Value.GetType()
: object {string}d.Value.DefaultValue.GetType()
: object {string}d.Value.DefaultValue.Equals(d.Value.Value)
: true
I expected that d.Value.Value != d.Value.DefaultValue
will not be equal to d.Value.DefaultValue.Equals(d.Value.Value)
, but they are the same.