From. from NET 1.0, VB. net, that is, ingress has two new operation operators: andalso and orelse (in C #, as &, | operation operator ), it can be used as short-circuiting to improve program performance. That is to say, when the first computing formula can determine the final result, it does not need to be counted as the operation after the calculation. If the last content is incircle, incircle, or contentProgramWhen the call formula is used, the call efficiency will be improved more clearly. The following is an example:
1DimAAs Integer = 20
2DimBAs Integer = 10
3DimCAs Integer = 5
4DimBlnAs Boolean
5Bln=A>BAndalsoB>C'The result is true, and the second formula is ignored.
6 bln = B > A andalso B > C ' the result is false. the second formula cannot be used
7Bln=A>BAndalsoC>B'If the result is false, the second formula will be deleted.
8Bln=A>BOrelseB>C'Returns true,The second formula cannot be used.
9Bln=B>AOrelseB>C'The result is true, and the second formula is ignored.
10 bln = B > A orelse C > B ' the result is false, the second formula is counted
As shown in the preceding example, in most cases, we should use andalso and orelse to replace and or operators. In addition, the new versions of Java and C # support the generic type (generic) in VB 2005 ), in addition to changing the temporary transaction to temporary transaction and incremental data security, to some extent, program performance can be improved, because boxing/unboxing between value type and object type can be reduced.
(In this article, the release date of the release blog is 2006/04/16)