Format exception when I am converting to Int32

前端 未结 5 1392
深忆病人
深忆病人 2020-12-22 15:32

While i am trying to convert a value to Int32, I get an error format exception, meaning the value is not in the proper format. I think I am converting a value in right forma

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-22 15:57

    You can always check the type of the value you are passing in to such functions by using the GetType().

    The condition where I was stuck in this issue was conversion of a dynamically generated stringyfied decimal value to int. Figured out the type of the value using the GetType() and first converting it into double then int solved the problem.

提交回复
热议问题