AnsweredAssumed Answered

'ESRI.ArcGIS.Carto.IMap.Layer' cannot be used like a method

Question asked by shaningesri on May 22, 2012
Latest reply on May 22, 2012 by kenbuja
I user to program ArcObjects using VB and then .Net. For such a simple piece of code (I used it before) as below:
IMxDocument pDoc = m_app.Document as IMxDocument;
IMap pMap = pDoc.FocusMap;
ILayer pLayer;
for (int i = 0; i < pMap.LayerCount; i++) {
pLayer = pMap.Layer(i); // Got error
//
}
Error 2 Non-invocable member 'ESRI.ArcGIS.Carto.IMap.Layer' cannot be used like a method.
What's wrong with it? Thanks.

Outcomes