Access the Object Hierarchy (.NET)

While the Application is the root object in the AutoCAD .NET API, you commonly will be working with the database of the current drawing. The DocumentManager property of the Application object allows you to access the current document with the MdiActiveDocument property. From the Document object returned by the MdiActiveDocument property, you can access its database with the Database property.

VB.NET

Application.DocumentManager.MdiActiveDocument.Database.Clayer

C#

Application.DocumentManager.MdiActiveDocument.Database.Clayer;

VBA/ActiveX Code Reference

ThisDrawing.ActiveLayer