' (Works exactly like Scripting.Dictionary) Dim Dict As New Dictionary Dict.CompareMode = CompareMethod.TextCompare Dict( "A" ) ' -> Empty Dict( "A" ) = 123 Dict( "A" ) ' -> = Dict.Item("A") = 123 Dict.Exists "A" ' -> True Dict.Add "A", 456 ' -> Throws 457: This key is already associated with an element of this collection ' Both Set and Let work Set Dict( "B" ) = New Dictionary Dict( "B" ).Add "Inner", "Value" Dict( "B" )( "Inner" ) ' -> "Value" UBound(Dict.Keys) ' -> 1 UBound(Dict.Items) ' -> 1 ' Rename key Dict.Key( "B" ) = "C" Dict.Exists "B" ' -> False Dict( "C" )( "Inner" ) ' -> "Value" ' Trying to remove non-existant key throws 32811 Dict.Remove "B" ' -> Throws 32811: Application-defined or object-defined error ' Trying to change CompareMode when there are items in the Dictionary throws 5 Dict.CompareMode = CompareMethod.Binaråompare ' -> Throws 5: Invalid procedure call or argument Dict.Remove "A" Dict.RemoveAll Dict.Exists "A" ' -> False Dict( "C" ) ' -> Empty Release Notes 1.4.0
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |