[Mono-devel-list] C# version of code runs but VB.Net version crashes!

Sunil Venkateswara sunvenk at hotmail.com
Wed Mar 17 11:04:48 EST 2004


I have the same piece of code that has been written in C# and then in 
VB.Net.
The C# code runs to completion but the VB.Net application crashes with a 
System.OverflowException.
Code is given below.

Can somebody please help me understand this behavior?


**C# application code Start** (This goes into main)
int i=0,j=0,k=0,l=0,m=0,n=0;
while (i < 10000000)
{
j = i + n + 1;
k = j * 10;
l = (i - 1) + k;
m = ((j + i) * 10) - (l - 4) * 51;
n = (m + 1) - i;
i = i + 1;
}
**C# application code End**

**VB.Nerapplication code Start** (This goes into sub main)
        Dim i As New Integer()
        Dim j As New Integer()
        Dim k As New Integer()
        Dim l As New Integer()
        Dim m As New Integer()
        Dim n As New Integer()

        i = 0
        j = 0
        k = 0
        l = 0
        m = 0
        n = 0

        While (i < 10000000)
            j = i + n + 1
            k = j * 10
            l = (i - 1) + k
            m = ((j + i) * 10) - (l - 4) * 51
            n = (m + 1) - i
            i = i + 1
        End While
**VB.Nerapplication code End**

Thanks in advance

_________________________________________________________________
Protect your PC from viruses. Get in the experts. 
http://www.msn.co.in/pcsafety/ Click here now!




More information about the Mono-devel-list mailing list