In order to make life easier since the early development days, it was decided to use the same basic object names in the .NET version as had been used in the older COM version version, but this does make life difficult if anyone wishes to use both in the same project. In general, we would not recommend this, but recognise that it might occasionally be necessary. This then is a short guide to the steps needed if you do wish to use the COM & .NET versions of DicomObjects in the same project.
Add an extern alias line at the top of your source file (above existing using statements) referencing the alias you gave in the previous step.
extern alias DicomObjectsNET;
You need the form alias.DicomObjects.class
// create a .NET DicomImage object DicomObjectsNET.DicomObjects.DicomImage net_image = new DicomObjectsNET.DicomObjects.DicomImage(); // create a COM DicomImage object DicomObjects8.DicomImage com_image = new DicomObjects8.DicomImage();
Or make things simpler with a ‘using’ alias, this makes the above less of a typing ordeal.
extern alias DicomObjectsNET; using DoNET = DicomObjectsNET.DicomObjects; ... // create a .NET DicomImage object DoNET.DicomImage net_image = new DoNET.DicomImage(); // create a COM DicomImage object DicomObjects8.DicomImage com_image = new DicomObjects8.DicomImage();
Finally, please note that although this mechanism allows both forms of DicomObjects to be used in the same project, they are not programmatically equivalent, and you cannot for instance cast from one to the other, as the underlying representations are fundamentally different.