2011-12-01 80 views
0

我有一個問題,當我想獲得目錄Windows Phone 7的文件清單IsolatedStorage

文件的列表,這是我的代碼

try 
     { 
      using (var store = IsolatedStorageFile.GetUserStoreForApplication()) 
      { 
       StringBuilder sb = new StringBuilder(); 
       string subDir = Path.Combine("NotesYours", "Notes"); 
       if (store.DirectoryExists(subDir)) 
       { 

        string searchPath = Path.Combine(subDir, "*"); 
        string[] fileInSubDir = store.GetFileNames(searchPath); 
        tbtbtes.Text = fileInSubDir.Length.ToString(); 
       } 
       else 
       { 
        MessageBox.Show("dir not exist"); 
       } 
      } 
     } 
     catch (IsolatedStorageException) 
     { 

     } 

長度如果fileInSubDir是零,而我已經創建了三個文件之前,所以它必須是fileInSubDir的長度是3,而不是零

請幫我:(

+0

有一堆用於查找獨立存儲的工具。確保你已經成功保存了這三個文件。 – Ku6opr

回答

0

我記得的一半,這意味着通配符搜索只用錯誤GetFileNames中的無法正常工作。
您是否驗證了文件存在或嘗試使用較少的通用搜索詞?

相關問題