Skip To Content

MapLayer.Names (.NET)

The MapLayer.Names method returns an indexed dictionary of map and imagery layer names included in the current drawing. The key is an index number used to identify the layer, and the indexed value is the name of the layer as a string. The index number is used to identify a map or imagery layer in other methods such as MapLayer.Get.

Declaration

public Dictionary<int, string> Esri.ArcGISForAutoCAD.MapLayer.Names(Document doc)

Parameter

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

Returns

TypeDescription

Dictionary<int, string>

An indexed dictionary of map and imagery layer names. Key: Index number, Value: Layer name.

Remarks on error conditions

This method may throw an exception or return null if a parameter is invalid.

Example

Print the index numbers and names of the map and imagery layers in the drawing.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;

// Get the index numbers and names
var names = Esri.ArcGISForAutoCAD.MapLayer.Names(doc);

// Print the index numbers and names
foreach (var name in names)
{
  doc.Editor.WriteMessage("\nIndex: {0}, Name: {1}", name.Key, name.Value);
}

/* Example output 
Index: 1, Name: SST
Index: 2, Name: Seafloor Dissolved Oxygen
Index: 3, Name: World Street Map
Index: 4, Name: World Light Gray Base
*/

See also

MapLayer.Get—A .NET method that returns the map or imagery layer properties for the specified map or imagery layer referenced by its map index number.