On the difference between the FOR cycle statement in C # and VB.NET!

zhaozj2021-02-12  215

C # code:

INT count = 10;

For (int i = 1; i <= count; i ) {count = 5; MessageBox.show ("i =" i.toString ());}

VB.NET code:

DIM I as int32, count as int32 = 10

For i = 1 to count count = 5 messagebox.show ("i =" i.toString ()) Next

The above very simple code will produce a very different effect! Oh ^ _ ^

The C # version executed 5 cycles, and the VB.NET version executed 10 cycles. Why is this, huh, huh, look at their IL, you will understand.

转载请注明原文地址:https://www.9cbs.com/read-7159.html

New Post(0)