Zookeeper operators that can improve the efficiency in DOTNET statement

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.