private void LayerName()
{
IMxDocument pMxDoc = default(IMxDocument);
IMap pMap = default(IMap);
IFeatureLayer pFeatureLayer = default(IFeatureLayer);
//Assign the mxDocument here..however you retrieved it...I usually use the snippet for retrieving the MxDoc from ArcMap
pMxDoc = ThisDocument;
pMap = pMxDoc.FocusMap;
// Loop through each layer, and report its name.
for (i = 1; i <= pMap.LayerCount; i++) {
pFeatureLayer = pMap.Layer(i);
Interaction.MsgBox("The name of layer is: " + pFeatureLayer.name);
}
}