I have a module containing several classes. The purpose of the module is to deal with reading a certain complex file type (DICOM, the medical imaging file type).
One of the requirements I need from a class in the module is to match the tag of an element in the file with it’s value representation. Essentially, there are about 2000 different tags, each with one of about 30 different value representations.
I’m trying to figure out the fastest way to look up the value representations of these different tags. One option is to have 2000 constants in the module or the parent class (DICOMObject) and then have a giant select case block that takes the tag as a String and returns it’s value representation. Obviously a Dictionary seems a more sensible approach as I could have each of the unique 2000 types as a key in the Dictionary and the value representation as its corresponding Dictionary value.
My question is this: is it possible to have a shared Dictionary or static Dictionary such that I don’t have to instantiate more than one instance of this large Dictionary in the app? I know I could have a global Dictionary in the app to do this but I’m trying to follow best programming practices and I want to share this module with others in the future so I’d like to have everything contained in the module if possible.
Thoughts?