问题
I have a variable which is storing as decimal:
decimal firststYrComp = Int16.Parse(tb1stYr.Text.ToString());
Now I have this to get typecasted into Double? How do I do that? Thanks!
回答1:
You answered your own question—Just cast it to a double:
decimal x = 3.141592654M ;
double pi = (double) x ;
回答2:
You can use decimal's built in converter.
decimal decimalValue = 5;
double doubleValue = decimal.ToDouble(decimalValue);
回答3:
Just Try
Decimal yourDecimal = 3.222222m;
Convert.ToDouble(yourDecimal);
来源:https://stackoverflow.com/questions/5571485/converting-decimal-to-double-in-c