How could I convert data from string to long in c#

前端 未结 9 2135
慢半拍i
慢半拍i 2021-02-02 04:45

How could i convert data from string to long in C#?

I have data

String strValue[i] =\"1100.25\";

now i want it in

long         


        
9条回答
  •  遥遥无期
    2021-02-02 05:18

    You won't be able to convert it directly to long because of the decimal point i think you should convert it into decimal and then convert it into long something like this:

    String strValue[i] = "1100.25";
    long l1 = Convert.ToInt64(Convert.ToDecimal(strValue));
    

    hope this helps!

提交回复
热议问题