I need to add an item after a specific key and item pair in a dictionary. Essentially the same behavior which the add member allows for in a collection:
(Collection.Add (item [,key] [,before] [,after])
I need to add an item after a specific key and item pair in
Share
There is no built-in method of the Dictionary object that allows this. Here is a quick way to roll your own. This will accomplish specifically what you are asking for but it should be simple to modify:
And to test it run the following procedure:
This is just to get you started. If I were doing this for myself I would probably create my own custom class to use and create a custom Add method instead of using a function. I’d also make the following improvements: