I am having a little trouble designing an efficient data storage method of storing some bookmark elements for a word automation project. Here is what i need to do. I need to get all the bookmarkstart and bookmark end and the bookmark id stored in a neat data structure that lets me access any one of these three objects given one of them with the least runtime complexity. If for example i didnt need the id to be stored, i could just make a dictionary and use the bookmark start as a key and the bookmark end as a value to have an access time of O(1). But is there a logical, simple and efficient structure to have this functionalty with all three of these items coupled together?
Thanks
You are looking at implementing a customized Map/Hash/Dictionary class for this purpose.
Basically:
}
This data structure doesn’t really map onto IDictionary, but you could maybe make it implement ICollection if iteration, and contracts are important to you.
If the O(1) lookup is not sooo important, you could alternatively just implement this as an List and do lookups using LINQ and simplify your life a bit. Remember, premature optimization is bad.