The documentation for the AI says (in part

):
"The ObjectType enumeration identifies Enterprise Architect object types even when referenced through a Dispatch interface.
For example:
Object ob = Repository.GetElementByID(13);
if ( ob.ObjectType == otElement )
;
else if( ob.ObjectType == otAuthor )"
I can't seem to get this to work properly... here's what I've tried in C#
The only Object class is a C# Object and that, of course, doesn't have ObjectType... there doesn't appear to be an EA.Object - the object model appears flat?
if I follow the API and do this:
EA.Element e = Repository.GetElementByID(13);
and if object 13 happens to be a Package,
then this doesn't seem to work
if (e.ObjectType == otPackage), seems the objectType is always otElement,
however, this appears to work:
if (e.Type == @"Package")
while I can go off and do this, is just doesn't "feel" right - what am I missing?
Also, what I'm really trying to do is walk the tree view and dispatch various element types to their own "print" or detail routines... most, but not all, elements have elements collections, diagram collections and package collections (among some others)... however, it doesn't seem that I can use some abstract superclass to cast my elements so that I can just get {superClass}.Diagrams for example, you have to Package.Diagrams or Element.Diagrams, which is why I think I need to determine the type of object I'm dealing with to cast it and then process collections. Thinking that would lend itself to a nice recursive method to walk the tree, dispatching the "print" or detailed part of any element appropriately.
Any ideas?
thanks - cwt