Ifeaturelayer to Ifeatureclass

Discussion created by pd.jayakumar on Feb 10, 2014
Latest reply on Feb 13, 2014 by DevonTaig

IMapDocument pmd = new MapDocumentClass();
            if (pmd.get_IsMapDocument(@"F:/Projects/Inprogress.mxd"))
                pmd.Open(@"F:/Projects/Inprogress.mxd", null);
                IMap pmap = pmd as IMap;
                pmap = pmd.get_Map(0);
                Console.WriteLine(pmap.Name);//prints the Layer
                ILayer PL = pmap.get_Layer(1);
                Console.WriteLine(PL.Name);//prints the first layer
                IFeatureLayer FL = PL as IFeatureLayer;
                Console.WriteLine(FL.Name);//prints the first layer ofter typecasting to Feature Layer also
                IFeatureClass FC = FL.FeatureClass; //after this I want to print the fields and rows.
                  There is not compiler error, it is showing FC||Null

               How to move further..any help will be appreciated.

Thanks in advance