title: Creating a unique hash code based on some properties of an object
body: <p>I have to following classes:</p>
  
  <pre><code>public class NominalValue
  {
     public int Id {get; set;}
     public string ElementName {get; set;}
     public decimal From {get; set;}  
     public decimal To {get; set;}    
     public bool Enable {get; set;}   
     public DateTime CreationDate {get; set;}
     public int StandardValueId {get; set;}  //FK for StandardValue
  } 
  public class StandardValue
  {
     public int Id {get; set;}
     public string ElementName {get; set;}
     public decimal From {get; set;}  
     public decimal To {get; set;}    
     public bool Enable {get; set;}   
     public DateTime CreationDate {get; set;}
  } 
  </code></pre>
  
  <p>User wants to fill <code>nominalValue</code> object properties. filling the <code>nominalValue</code> properties can performed in 2 way:</p>
  
  <ol>
  <li>User fill values for <code>nominalValue</code> manually.</li>
  <li>User Load values for <code>nominalValue</code> from a <code>standardValue</code> object and then change some values or not.</li>
  </ol>
  
  <p>sometimes I need to know if some property of <code>nominalValue</code> objects for a specified Element are equal to corresponding <code>standardValue</code> or not?</p>
  
  <p>I don't want to load <code>standardValue</code> from <code>Db</code> for checking this equality, so I decided to define a <code>HashValue</code> property in <code>NominalValue</code> class:</p>
  
  <pre><code>public class NominalValue
  {
     public int Id {get; set;}
     public string ElementName {get; set;}
     public decimal From {get; set;}  //&lt;-- 1st parameter for generating hash value
     public decimal To {get; set;}    //&lt;-- 2nd parameter for generating hash value
     public bool Enable {get; set;}   //&lt;-- 3rd parameter for generating hash value 
     public DateTime CreationDate {get; set;}
     public int StandardValueId {get; set;}  
     public string HashValue {get;set;}      //&lt;-- this property added
  } 
  </code></pre>
  
  <p>when user fill <code>nominalValue</code> properties using <code>standardValue</code> properties, I calculate its value based on 3 properties(<code>From</code>, <code>To</code>, <code>Enable</code>) and save it with other properties, and when I check if that <code>nominalValue</code> fill with <code>standardValue</code> or not, I calculate hash code for <code>From</code>, <code>To</code>, <code>Enable</code> and compare the result with <code>HashValue</code> (instead loading <code>standardValue</code> from <code>Db</code>).</p>
  
  <p>Is there any mechanism to calculate a unique hash code based on 3 property values(<code>From</code>, <code>To</code>, <code>Enable</code>)?</p>