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 -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -