I have a DICOM dictionary containing a collection of objects, all of which are derived from a DataElement. The dictionary has an int as a key and a DataElement as property. My DICOM dictionary has this property [], where I can access the DataElement, for example:
public class DicomDictionary { Dictionary<int, DataElement> myElements = new Dictionary<int, DataElement>(); . . public DataElement this[int DataElementTag] { get { return myElements[int]; } } }
Now the problem is that I have different types of DataElement, all of which are based on DataElement, like DataElementSQ, DataElementOB, etc. Now, I would like to do the following to make writing in C # a little easier:
public T this<T>[int DataElementTag] where T : DataElement { get { return myElements[int]; } }
But it is really impossible. Is there something I missed? Of course, I could do this with the Getter method, but it would be much better to have it this way.
msedi
source share