Piccola curiosita': tra Double.Parse e Convert.ToDouble quale e' meglio?, la risposta a IL!
 
Dim ris As Double = Convert.ToDouble(Me.TextBox1.Text) - Convert.ToDouble(Me.TextBox2.Text)
 
{
  // Code size       37 (0x25)
  .maxstack  2
  .locals init ([0] float64 ris)
  IL_0000:  nop
  IL_0001:  ldarg.0
  IL_0002:  callvirt   instance class [System.Windows.Forms]System.Windows.Forms.TextBox Benchmark.Form1::get_TextBox1()
  IL_0007:  callvirt   instance string [System.Windows.Forms]System.Windows.Forms.TextBox::get_Text()
  IL_000c:  call       float64 [mscorlib]System.Convert::ToDouble(string)
  IL_0011:  ldarg.0
  IL_0012:  callvirt   instance class [System.Windows.Forms]System.Windows.Forms.TextBox Benchmark.Form1::get_TextBox2()
  IL_0017:  callvirt   instance string [System.Windows.Forms]System.Windows.Forms.TextBox::get_Text()
  IL_001c:  call       float64 [mscorlib]System.Convert::ToDouble(string)
  IL_0021:  sub
  IL_0022:  stloc.0
  IL_0023:  nop
  IL_0024:  ret
} // end of method Form1::Button1_Click
 

Dim ris2 As Double = Double.Parse(Me.TextBox1.Text) - Double.Parse(Me.TextBox2.Text)
 

{
  // Code size       37 (0x25)
  .maxstack  2
  .locals init ([0] float64 ris2)
  IL_0000:  nop
  IL_0001:  ldarg.0
  IL_0002:  callvirt   instance class [System.Windows.Forms]System.Windows.Forms.TextBox Benchmark.Form1::get_TextBox1()
  IL_0007:  callvirt   instance string [System.Windows.Forms]System.Windows.Forms.TextBox::get_Text()
  IL_000c:  call       float64 [mscorlib]System.Double::Parse(string)
  IL_0011:  ldarg.0
  IL_0012:  callvirt   instance class [System.Windows.Forms]System.Windows.Forms.TextBox Benchmark.Form1::get_TextBox2()
  IL_0017:  callvirt   instance string [System.Windows.Forms]System.Windows.Forms.TextBox::get_Text()
  IL_001c:  call       float64 [mscorlib]System.Double::Parse(string)
  IL_0021:  sub
  IL_0022:  stloc.0
  IL_0023:  nop
  IL_0024:  ret
} // end of method Form1::Button1_Click
 
Sembrerebbero identiche a meno di System.Double vs System.Convert..., ok andiamo a vedere cosa fa System.Convert.ToDouble
 
public static double ToDouble(string value)
{ if (value == null)
{
 return 0;
}
return double.Parse(value);
}
 
Morale, volendo fare i pignoli... e' meglio usare il metodo Double.Parse (ma questo lo sapevamo gia' vero?)