title: Powershell Hashtable Count and Keys Properties getting overloaded
body: <p><strong>Problem Statement</strong>:  The Count and Keys properties can get overloaded by a hash value and not return their expected values.</p>
  
  <p>My Powershell Code is this:</p>
  
  <pre><code>$hash = @{}
  $hash.one = "Number 1"
  $hash.two = "Number 2"
  
  "Count is [{0}]" -f $hash.Count
  $hash.Count = "Count's Hash Value"
  "Count is now [{0}]" -f $hash.Count
  </code></pre>
  
  <p>My Output is this:</p>
  
  <pre><code>Count is [2]
  Count is now [Count's Hash Value]
  </code></pre>
  
  <p>The Count Property gets overloaded!   This issues could cause users some very hard to diagnose bugs.   Had me confused for a good while.    Same issue applies to "Keys" or in fact any Property.</p>
  
  <p>Do you have any thoughts on best practice to avoid this one? Maybe a different System.Collection?  or prefixing all Keys with a character such as:</p>
  
  <pre><code>$key = ":" + $key 
  </code></pre>
  
  <p>However, its not very elegant.  Even now that I know the issue, I suspect I will forget and make the same mistake again.</p>
  
  <p>I personally think it is a problem with the Powershell Language Definition.  The . notation (as in $hash.MyKey) should not be allowed for retrieving hash values, only for retrieving Property values.  Just a thought. :-) </p>
  
  <p>Thanks for your help.</p>