title: What is CDbl doing?
body: <p>I had until recently been under the impression that the <code>CDbl(x)</code> operation in VB.NET was essentially a cast (i.e., the VB equivalent of <code>(double)x</code> in C#); but a recent discovery has revealed that this is not the case.</p>
  
  <p>If I have this string:</p>
  
  <pre><code>Dim s As String = "12345.12345-"
  </code></pre>
  
  <p>And I do this:</p>
  
  <pre><code>Dim d As Double = CDbl(s)
  </code></pre>
  
  <p><code>d</code> will be set to the value <code>-12345.12345</code>! Now, don't get me wrong, this is kind of convenient in my particular scenario; but I have to admit I'm confused as to <em>why</em> this works. In particular, I'm confused because:</p>
  
  <ul>
  <li><code>Double.Parse</code> does not work with the above input.</li>
  <li><code>Double.TryParse</code> does not work.</li>
  <li><code>Convert.ToDouble</code> does not work.</li>
  </ul>
  
  <p>How is <code>CDbl</code> so clever?</p>