问题
i have a problem when i want get list of file in a directory
this is my code
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)
{
}
length if fileInSubDir is zero, whereas i have created three file before, So it must be the Length of fileInSubDir is Three, not zero
please help me :(
回答1:
I half remember a bug which meant wildcard searches just using *
in GetFileNames didn't work correctly.
Have you verified that the files are there or tried using a less generic search term?
来源:https://stackoverflow.com/questions/8344074/windows-phone-7-file-listing-isolatedstorage