0
當我試圖轉換成數據集的XML獨立存儲文件我得到這樣一個異常「無法訪問,因爲正在使用由其他用戶」XML轉換成數據集
我的代碼:
IsolatedStorageFile isfInsuranceFirm = null;
isfInsuranceFirm = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain, null, null);
Stream stream1 = new IsolatedStorageFileStream("PageAccess.xml",FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, isfInsuranceFirm);
stream1.Position = 0;
string path1 = stream1.GetType().GetField("m_FullPath", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(stream1).ToString();
string path2 = stream2.GetType().GetField("m_FullPath", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(stream2).ToString();
XmlDataDocument doc = new XmlDataDocument();
//doc.LoadXml(path1.Substring(path1.IndexOf('/') + 1));
doc.Load(path1);
我試着如你所說,但同樣的錯誤發生 – sidd2004k