Got a problem with a code conversion from C# to VB.Net.
var x = 5783615;
var y = 56811584;
var t = x * y;
x, y and t are integers. In c# ‘t’ will be -1553649728.
In VB.Net, I will get an integer overflow exception.
Any idea how to fix it?
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.
C#, by default, doesn’t check for overflows, but VB does (by default).
You can setup your VB Project to not check for integer overflows in the Advanced Compile Options in the Compile tab. This will cause that specific project to stop raising OverflowException in cases like this.