In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "VBS how to achieve array classes in ArrayList Class vbs", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "VBS how to achieve array classes in ArrayList Class vbs" this article.
Class ArrayList
Private items ()
Private size
Private Sub Class_Initialize
Size = 0
ReDim items (1)
End Sub
Private Sub Class_Terminate
Items = null
End Sub
Public Function Add (ByVal value)
If (size = Ubound (items)) Then EnsureCapacity ((size + 1))
Items (size) = value
Size = size + 1
Add = size
End Function
Public Property Get Item (index)
Item = items (index)
End Property
Public Property Let Item (index, vObject)
Items (index) = vObject
End Property
Property Get Count
Count = size
End Property
Public Property Get Capacity ()
Capacity = Ubound (items)
End Property
Public Property Let Capacity (value)
If (value Ubound (items)) Then
If (value
< size) Then Err.Rise 6 If (value >0) Then
ReDim Preserve items (value)
Else
ReDim Preserve items (3)
End If
End If
End Property
Private Sub EnsureCapacity (ByVal min)
If (Ubound (items) < min) Then
Dim num1: num1 = IIf ((Ubound (items) = 0), 4, (Ubound (items) * 2))
If (num1 < min) Then num1 = min
Capacity = num1
End If
End Sub
Private Function IIf (j, R1, R2)
IF (j) Then
IIf = R1
Else
IIf = R2
End IF
End Function
End Class
Example:
Dim al: Set al = new ArrayList
Al.Add (1)
Al.Add (2)
Al.Add (3)
Al.Add (4)
Al.Add (5)
Al.Add (6)
Al.Add (7)
Al.Add (8)
Al.Add (9)
Al.Add (10)
For I = 0 To al.Count-1
W ("Index" & I & ":" & al.Item (I))
Next
W ("Count:" & al.Count)
W ("Capacity:" & al.Capacity)
Sub w (o)
Response.Write (o & "")
End Sub
These are all the contents of the article "how VBS implements array classes in ArrayList Class vbs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.