The .NET API
provides all its objects under namespace hierarchies. By default, an object
is qualified in the current scope if the namespace is imported. Because
everything is qualified under a namespace, you will find cases where objects
may have the same name, but live under different namespaces. This will
confuse the standard qualification because the compiler cannot determine
which object you are specifically referring to. Fortunately both C# and
VB.NET languages provide an alias mechanism to make it easier to qualify the
namespaces appropriately when necessary. |
|
For example, there
is a different object named DBObject in both ACA and AutoCAD .NET APIs. You
will see an ambiguous reference error when trying to use this type in a
typical way. The reason for this is because the object lives in both the
Autodesk.AutoCAD.DatabaseServices and Autodesk.Aec.DatabaseServices
namespaces. In order to resolve the ambiguity, you must clarify the namespace
of the version you are intending to use. |
|
At Object level: |
|
using AcDBObject =
Autodesk.AutoCAD.DatabaseServices.DBObject; |
|
using AecDBObject =
Autodesk.Aec.DatabaseServices.DBObject; |
|
... |
|
AecDBObject obj =
new AecDBObject(); |
|
Or at the namespace
level: |
|
using AcDb =
Autodesk.AutoCAD.DatabaseServices; // AutoCAD database objects |
|
using AecDb =
Autodesk.Aec.DatabaseServices; // ACA Base classes |
|
... |
|
AecDb.DBObject obj =
new AecDb.DBObject(); |