myarraylist.vb
来自「Mastering VBNet Include Source Code」· VB 代码 · 共 50 行
VB
50 行
Option Strict On
Public Class myArrayList
Inherits ArrayList
Function Min() As String
Dim i As Integer
Dim minValue As String
minValue = MyBase.Item(0).ToString
For i = 1 To MyBase.Count - 1
If MyBase.Item(i).ToString < minValue Then minValue = MyBase.Item(i).ToString
Next
Min = minValue
End Function
Function NumMin() As Double
Dim i As Integer
Dim minValue As Double
minValue = 1.0E+230
For i = 1 To MyBase.Count - 1
If IsNumeric(MyBase.Item(i)) And Val(MyBase.Item(i).ToString) < minValue Then minValue = Val(MyBase.Item(i).ToString)
Next
NumMin = minValue
End Function
Function GetString() As String
Dim i As Integer
Dim strValue As String
strValue = MyBase.Item(0).ToString
For i = 1 To MyBase.Count - 1
strValue = strValue & vbCrLf & MyBase.Item(i).ToString
Next
GetString = strValue
End Function
Sub EliminateDuplicates()
Dim i As Integer = 0
Dim delEntries As ArrayList
While i <= MyBase.Count - 2
Dim j As Integer = i + 1
While j <= MyBase.Count - 1
If MyBase.Item(i).ToString = MyBase.Item(j).ToString Then
MyBase.RemoveAt(j)
End If
j = j + 1
End While
i = i + 1
End While
End Sub
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?