[译]Visual Basic 2005在语言上的增强(十三)显式的数组范围及小结

2016-01-29 12:59 1 1 收藏

[译]Visual Basic 2005在语言上的增强(十三)显式的数组范围及小结,[译]Visual Basic 2005在语言上的增强(十三)显式的数组范围及小结

【 tulaoshi.com - ASP.NET 】

显式的数组范围

你现在可以使用显式的数组范围来声明数组,这样的声明更加清晰可读了:
Dim a(10) As Integer '旧方式
Dim b(0 To 10) As Integer '新方式

Visual Basic中的数组范围仍然是以零为起始,所以如果你想声明一个不是以零为起始范围的数组,你就会得到一个编译器错误。

小结

Visual Basic 2005语言获得了一些重要的特性以及诸多细微的增强,这些都极大地提高了它的易用性和开发人员的生产效率。这个语言变得更加完善,并且和C#的不少主要特性也更好地对应起来,诸如XML注释和操作符重载。

把IDE上不胜枚举的增强功能考虑进去,Visual Basic 2005将会是Visual Basic所有的已发行版本中最强大的一款。不但从语言特性方面得到了增强,而且使用它简直充满了纯粹的乐趣。现在唯一令我遗憾的是我还无法使用Visual Basic 2005创建生产应用程序。你也来试爽一下Beta版吧,我想你会同意我的观点的。

译后记

译完了Stan Schultes先生的《Language Enhancements in Visual Basic 2005》系列文章,觉得总算做完了一件挺大的事情。在这里涕淌要感谢所有来涕淌居阅读这些文章并提出各种尖锐意见的网友们,谢谢你们!唉~~~无论多么华丽的辞藻都无法表达涕淌对Visual Basic的爱意。2005年到来了,让我们一起祝福她吧!


@以下是原文供网友们参考@

Explicit Array Bounds

You can now declare arrays using explicit array bounds to make the declaration clearer:
Dim a(10) As Integer 'old way
Dim b(0 To 10) As Integer 'new way


Array bounds in Visual Basic are still zero-based, so you'll get a compiler error if the array lower bounds value isn't 0.

Conclusion

The Visual Basic 2005 language gains several major features and many smaller enhancements that together provide significant increases in ease of use and developer productivity. The language has become more complete, and there is more parity with C# on major features like XML comments and operator overloading.

Coupled with a myriad of IDE enhancements, Visual Basic 2005 is poised to be the best version of Visual Basic ever released. Not only better from a language feature standpoint, but it's also a sheer joy to use. I'm disappointed only because I can't build production applications with the Visual Basic 2005 today. Give the Beta version a try, and I think you'll agree.

来源:https://www.tulaoshi.com/n/20160129/1488438.html

延伸阅读
标签: vb
升级 向导 将 Currency 数据类型转换为 Decimal,因此以下代码: Dim x As Currency 升级后将变为: Dim x As Decimal Date Visual Basic 6.0 Date 变量在内部以 Double 格式存储,能够作为 Double 类型的变量操作。 Date 变量存储为 IEEE 64 位浮点数,表示从 100 年 1 月 1 日到 9999 年 12 月 31 日的日期和从 0:...
标签: vb
升级 向导 过程的 ParamArray 参数标记有升级警告。例如,以下代码: Function MyFunction(ParamArray p() As Variant) ... End Function 升级后将变为: UPGRADE_WARNING: ParamArray p was changed from ByRef to ByVal Function MyFunction(ByVal ParamArray p() As Object) ... End Function 声明中的...
使用 CommandButton 控件 命令按钮控件被用来启动、中断或结束一个进程。单击它时将调用已写入Click 事件过程中的命令。 大多数 Visual Basic 应用程序中都有命令按钮,用户可以单击按钮执行操作。单击时,按钮不仅能执行相应的操作,而且看起来就象是被按下和松开一样,因此有时称其为下压按钮。 详细信息 关于 CommandB...
使用 ADO Data 控件 ADO Data 控件使用 Microsoft ActiveX 数据对象(ADO) 来快速建立数据绑定的控件和数据提供者之间的连接。数据绑定控件是任何具有数据源属性的控件。数据提供者可以是任何符合 OLE DB 规范的数据源。使用Visual Basic 的类模块也可以很方便地创建子集的数据提供者。 尽管可以在应用程序中直接使用 ActiveX 数...
创建显示的窗体 最后,我们可以创建窗体,将其用于启动或取消后台进程。该窗体还将显示活动和状态信息。 打开 Form1 的设计器并添加两个按钮( btnStart 和 btnRequestCancel )、两个标签( Label1 和 Label2 )、一个 ProgressBar ( ProgressBar1 ) 和一个 ActivityBar ( ActivityBar1 ),如图 7 所示。 图 7:Form1 控件的布局 ...

经验教程

350

收藏

82
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部