title: Same value, unknown type equality in reflection
body: <p>I'm using reflection to retrieve the value of a property from an object. The value is an enum:</p>
  
  <pre><code>enum MyEnum 
  {
      None,
      SomeValue
  }
  </code></pre>
  
  <p>Which is on an object, and the property also has an attribute</p>
  
  <pre><code>class MyObject
  {
      [MyAttribute(ExclusionValue = MyEnum.None)]
      public MyEnum EnumProperty { get; set; }
  }
  </code></pre>
  
  <p>So when I get to the reflection part of things I would like to check if the value is equal to the <code>ExclusionValue</code></p>
  
  <pre><code>// exclusionValue is the value taken from the attribute
  // propertyValue is the value retrieved by reflection of the containing object, so at 
  // this time it just an `object` type.
  
  if(exclusionValue == propertyValue)
  {
      // Both values are `MyEnum.None` but the if statement never evaluates true.
  }
  </code></pre>
  
  <p>I've tried to cast the <code>exclusionValue</code> to an object so that they are both the same visible type</p>
  
  <pre><code>if((object)exclusionValue == propertyValue)
  </code></pre>
  
  <p>But this never returns true either. They are definitely the same enum value. Also, I can't explicitly cast anything in this <code>if</code> statement because there are many other properties in the object of all different types (not just enums) that need this same check, for example:</p>
  
  <pre><code>class MyObject
  {
      [MyAttribute(ExclusionValue = MyEnum.None)]
      public MyEnum EnumProperty { get; set; }
  
      [MyAttribute(ExclusionValue = false)]
      public bool BoolProperty { get; set; }
  }
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>They will only ever be value types (no structs) or strings.</p>