[譯]Visual Basic 2005在語言上的增強(十三)顯式的數組範圍及小結

顯式的數組範圍

你現在可以使用顯式的數組範圍來聲明數組,這樣的聲明更加清晰可讀了:
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.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章