private const string FolderName = "temp1/NewFolder";
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
file.CreateDirectory(FolderName);
string[] array = file.GetDirectoryNames("temp1/");
}
}
在7.0版本当中,array.Length的值为1,但是在7.1版本中的array.Length为0,就是说在7.1当中获取不到数据。
查到MSDN 示例如下:
// Create directorie
store.CreateDirectory("MyApp1");
// Create subdirectorie under MyApp1.
string subdirectory1 = Path.Combine("MyApp1", "SubDir1");
store.CreateDirectory(subdirectory1);
// Create a file in a subdirectory.
IsolatedStorageFileStream subDirFile = store.CreateFile(Path.Combine(subdirectory1, "MyApp1A.txt"));
subDirFile.Close();
// Gather file information
string searchpath = Path.Combine(subdirectory1, "*.*");
string[] filesInSubDirs = store.GetFileNames(searchpath);
// Find subdirectories within the MyApp1 // directory using the multi character '*' wildcard.
string[] subDirectories = store.GetDirectoryNames(Path.Combine("MyApp1", "*"));
其中使用到了Path类并且使用了Combine方法,继续查找Path,没有查到Combine方法。所以 在Windows phone 中不能够使用Path
至于windows phone 7.1 如何让使用IdolatedStorageFile 仍在迷惑中。。。 如果你知道的话,请留言,分享是一种美德!!