In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use the VB.NET array, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
VB.NET array is a data type often used in programs. Although the syntax structure of the array in VB.NET retains many similarities with VB, it also has many differences with VB. The most intolerable differences among VB programmers are as follows:
1. Declare an array in VB.NET where the index values in the array elements all start with "0" instead of the index values in the previous VB that usually start with "1". This definition is very similar to VB.NET 's twin sister Visual C#.
two。 Since arrays have a uniform starting point in VB.NET, defining an array in VB.NET eliminates the need for the keyword "To" to set the range of the array. Declaring an array in VB.NET will be a little more concise than in VB. Array definitions are described in more detail later.
Declare, initialize, and access elements in the VB.NET array:
The Dim statement is still used to declare an array in VB.NET, and the main difference between the declarative array and VB has been briefly stated in the above. Here is the code to declare and initialize an array of strings of length "3" in VB.NET:
Dim arrString (2) As String = {"Monday", "Tuesday", "Wednesday"}
The following code applies for a 2 × 2 two-dimensional string array and initializes it:
Dim arrDate (1,1) As String = {Monday, 18th}, {Tuesday, 19th}}
The difference between a static array and a dynamic array is that the length of the static array is fixed while the length of the dynamic array is not fixed. The two arrays declared above are static arrays, while the following two pieces of code declare an one-dimensional array and a two-dimensional array, respectively, and initialize them:
Dim arrString () As String = {"Monday", "Tuesday", "Wednesday"} 'declare a dynamic one-dimensional array and initialize Dim arrDate (,) As String = {{"Monday", "18th"}, {"Tuesday", "19th"}' declare a dynamic two-dimensional array and initialize it
For other data types and more dimensional arrays, the declaration and initialization methods are basically the same as above, and only need to be modified according to the dimension and data type of the array.
After the array is declared and initialized, it can be accessed through the corresponding index value of the element in the array. The following two pieces of code access one element in the one-dimensional array and two-dimensional array declared and initialized above.
Dim sTemp1 As String = arrString (1) 'visit the second element of the arrString array Dim sTemp2 As String = arrDate (1,1)' visit the second row and the second column of the arrDate array. Thank you for reading this article carefully. I hope the article "how to use the VB.NET Array" shared by the editor will be helpful to you. At the same time, I hope you will support us, pay attention to the industry information channel, and more related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.