Re: Create a custom collection

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Mike,

> Dim md as New MyDictionary
> md.add("Mike", Object1)
> md.add("Mike", Object2)
> This will generate an error during compilation, because I cannot add Mike
> two times to the collection, we all know that.

I suppose that you mean at run-time not a compile-time...

> I need a key (string type, can be duplicate) and a value

Dictionaries use keys and keys, by definition, can not be duplicated.
Otherwise, when you try to retrieve an item by key, which one of the
duplicates you would return?

Maybe you would have to use a dictionary whose objects are collections
(allowing duplicates)...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers:
http://www.mztools.com





.