title: Why does a multi-line file not compare equal to itself?
body: <p>When I use <code>gc</code> (<code>get-content</code>) on the same file twice, and compare the strings using <code>-eq</code>, why does it compare unequal?</p>
  
  <pre><code>$f = "C:\temp\test.txt"
  echo Hello &gt; $f
  echo World &gt;&gt;$f # works if I uncomment this line
  
  gc $f
  
  # get the contents of the file twice and compare it to itself.
  if ((gc $f) -eq (gc $f)) {
      Write-Host "Hooray! The file is the same as itself."
  } else {
      Write-Host "Boo."
  }
  </code></pre>
  
  <p>Prints <code>Boo.</code>, unless I comment out the 3rd line - the problem only seems to occur with multiline files.</p>
  
  <p>(obviously in reality I wouldn't compare the file to itself, in real life I'm comparing two files that <em>might</em> have identical content).</p>
  
  <p>I'm running powershell 2.0.</p>