Today, I want to help a friend read a paragraphCodeHe used a piece of C # code. Since my friend is only familiar with VB.net, all the translation software he found was translated from C # To VB.net.
After searching for a long time, the problem has something to do with this sentence.
In C #
Int A, B, C;
A = B = C = 1 ;
Haha, after running a = B = c = 1, all three variables are 1, which is actually a bit mentally retarded.
Then go to VB. NET.
Dim A, B, c As Integer
A = B = C = 1
I casually asked three friends about this code. Everyone said it was the same as C. Obviously, the execution waits for 1, what do you think?
In fact, the result is not like this. After executing the = B = c = 1 sentence, you will find that ABC has not changed, and it is still 0. The reason is very simple, HH
In VB.net, = can be both a value assignment operator and a logical operator. Here it is a logical operator.
The bug is related to this.