AnsweredAssumed Answered

Field names and field count

Question asked by abab123 on Nov 22, 2014
Latest reply on Sep 15, 2015 by FGibson-esristaff

Hii, i am trying to display Field names and field count. here is my code but i am not getting result. Please help me



            IMxDocument pmx = m_application.Document as IMxDocument;

            IMap pmap = pmx.FocusMap;


            ILayer layer = pmap.get_Layer(0);


            IFeatureLayer pflayer = (IFeatureLayer)layer;


            IFeatureClass fc = pflayer.FeatureClass;


            IFields fields = fc.Fields;


            int fieldCount = fields.FieldCount;



            int endFieldIndex = fieldCount - 1;

            int fieldIndex = 0;

            while (fieldIndex <= endFieldIndex)


                IField field = fields.get_Field(fieldIndex);

                Console.WriteLine("The field at field index {0} is named (1)", fieldIndex, field.Name);

                //MessageBox.Show("The field at field index {0} is named (1)", fieldIndex.ToString(), field.Name);