当我尝试转换数据集中的 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);