The documentation for Add makes this very clear, I feel:
You can also use the Item property to add new elements by setting the value of a key that does not exist in the Dictionary(Of TKey, TValue)
; for example, myCollection[myKey] = myValue
(in Visual Basic, myCollection(myKey) = myValue
). However, if the specified key already exists in the Dictionary(Of TKey, TValue)
, setting the Item property overwrites the old value. In contrast, the Add
method throws an exception if a value with the specified key already exists.
(Note that the Item
property corresponds to the indexer.)
It's always worth consulting the documentation before asking a question...