.NET中自己构建一个ArrDictionary

作者:袖梨 2022-07-02
以下是ArrDictionary类:
Public Class ArrDictionary
      Private objCollection As New Collection
      Private objDic As New DictionaryEntry
      Private strKey, strValue As String
      Public i As Integer
      Public Function Item(ByVal Index As Integer) As Object
     Try
         Item = objCollection.Item(Index)
     Catch ex As Exception
         Item = "错误,无此项!"
     End Try
      End Function
      Public Function Item(ByVal Key As String) As Object
     Try
         Item = objCollection.Item(Key)
     Catch ex As Exception
         Item = "错误,无此项!"
     End Try
      End Function
      Public Sub Add(ByVal Key As String, ByVal Value As String)
     objDic.Key = Key
     objDic.Value = Value
     objCollection.Add(objDic, objDic.Key)
     i += 1
      End Sub
      Protected Overrides Sub Finalize()

相关文章

精彩推荐