title: How to properly compare decimal values in C#?
body: <p>I come from a background in C++, and I know that you cannot accurately compare floats for equality. For C#, I simply assumed the same policy applies to decimal values, or any floating point value in general.</p>
  
  <p>Basically, I have two decimal values and if they are NOT equal to each other, I need to perform some action. e.g.:</p>
  
  <pre><code>decimal value1, value2;
  // Assume value1 and value2 are set somewhere to valid values.
  if( value1 != value2 )
  {
      // Do something
  }
  </code></pre>
  
  <p>If this doesn't work as expected, I'm willing to accept a solution that does an equality comparison with a margin of error, say like .00001 or something like that. What would be the recommended solution to this problem?</p>