Converting Decimal to Double in C#?

后端 未结 3 1151
既然无缘
既然无缘 2021-02-06 20:21

I have a variable which is storing as decimal:

decimal firststYrComp = Int16.Parse(tb1stYr.Text.ToString());

Now I have this to get typecasted

3条回答
  •  终归单人心
    2021-02-06 21:14

    You answered your own question—Just cast it to a double:

    decimal x  = 3.141592654M ;
    double  pi = (double) x ;
    

提交回复
热议问题