大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> NET专区 -> Chapter 3 Major VB.NET Changes(3)

Chapter 3 Major VB.NET Changes(3)

时间: 2021-07-31 作者:daque

in vb6, you could call this sub in one of two ways:foo “hello ”call foo(“hello ”)in vb.net, you also could call this sub in one of two ways:foo(“hello ”)call foo(“hello ”)the difference, of course, is that the parentheses are always required in the vb.netcalls, even though you aren’t returning anything. the call statement is still sup-ported,but it is not really necessary.changes to boolean operatorsthe and , not , and or operators were to have undergone some changes. microsoftoriginally said that the operators would short-circuit, but now they are staying theway they worked in vb6. this means that in vb.net, as in vb6, if you had twoparts of an and statement and the first failed, vb6 still examined the second part.examine the following code:dim x as integerdim y as integerx =1y =0if x =2 and y =5/y then...as a human, you know that the variable x is equal to 1 . therefore, when you look atthe first part of the if statement, you know that x is not equal to 2 , so you would log-icallythink it should quit evaluating the expression. however, vb.net examines thesecond part of the expression, so this code would cause a divide-by-zero error.if you want short-circuiting, vb.net has introduced a couple of new operators:andalso and orelse . in this case, the following code would not generate an error invb.net:dim x as integerdim y as integerx =1y =0if x =2 andalso y =5/y then...this code does not cause an error; instead, because x is not equal to 2 , vb.net doesnot even examine the second condi

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.