File存在命令windows phone的问题

时间:2012-04-29 23:37:44

标签: xml windows-phone-7.1 isolatedstorage

我在互联网上发现此代码检查文件存在

using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (store.FileExists("Setting.xml"))
                {
                    MessageBox.Show("have file");
                }
                else
                {
                    MessageBox.Show("haven't file");                    
                }
            }

当我尝试时,它只显示条件“没有文件”。是否有Setting.xml文件? (我可以通过XDocument data = XDocument.Load(“Setting.xml”)加载这个文件;做或不做)?

1 个答案:

答案 0 :(得分:0)

你能检查一下这个“Setting.xml”文件是在IsolatedStorage吗?

因为,为了从IsolatedStorage访问文件 - 你应该使用IsolatedStorageFileStream。