Not only in .NET, but such conversion fails even in SQL Server 2005…
Can anyone tell me why ?.
Wouldn’t it be prudent to return just the integer part even in case of
Convert.ToInt32("10.2")
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Better fail than return some unexpected result.
10.0and10.2are not integers. If you know that you will be dealing with floating point numbers use the corresponding data type:Also don’t forget to take the culture into account when dealing with floating point numbers as the decimal separator might not always be
..