c# - Counting the total XML-files in a directory -


im trying write program counts total amounts of xml-files in directory , subdirectories. here how tried:

namespace jobbuppgift1 {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }         string path1 = "c:\\jobbuppg";          private void textbox1_textchanged(object sender, eventargs e)         {             int filecount = directory.getfiles(path1, "*.xml", searchoption.alldirectories).length;             textbox1.text = filecount.tostring();         }     } } 

i no error, nothing happens.

need add slash path1 otherwise "j" being escaped or "@" works too

namespace jobbuppgift1 { public partial class form1 : form {     public form1()     {         initializecomponent();     }     string path1 = "c:\\jobbuppg";//this or line below     string path1 = @"c:\jobbuppg";//this or line above      private void textbox1_textchanged(object sender, eventargs e)     {         int filecount = directory.getfiles(path1, "*.xml", searchoption.alldirectories).length;         textbox1.text = filecount.tostring();     } } 

}


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -