layer names to text box using C#

Discussion created by abab123 on Jun 14, 2014
Latest reply on Nov 22, 2014 by abab123
Hi, I am trying get layer names to text  box but i am not getting result.Here is my code
Can any one help

IMxDocument imx = m_application.Document as IMxDocument;
            IMap map = imx.FocusMap;
            StreamWriter sw = new StreamWriter("C:\\temp\\layer.txt");
            ILayer layer =null;
           // int lcount = map.LayerCount;
            IEnumLayer player = map.get_Layers(null, false);
            for (int i=0;i<map.LayerCount;i++)
           layer = player.Next();

            while (player!=null)

                layer = player.Next();