【问题标题】:How to get the isolated storage path for accessing the files and folders in windows phone7 application?windows phone7应用程序中如何获取访问文件和文件夹的隔离存储路径?
【发布时间】:2011-12-28 05:31:07
【问题描述】:

在 windows mobile 6 应用程序中,我使用 Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) 之类的代码
获取应用程序路径。

同样在windows phone7应用程序中,如何获取隔离存储路径以及如何访问我的应用程序中的文件和文件夹?
请给我一个示例代码来开发我的应用程序。

【问题讨论】:

    标签: c#-4.0 silverlight-4.0 windows-phone-7.1


    【解决方案1】:

    只需使用IsolatedStorageFile.GetUserStoreForApplication() 获取一个可以操作独立存储中的文件和目录的对象。

    请参阅此MSDN link,其中包含大量示例代码。

    【讨论】:

    • 你是对的,他可以像“var store = IsolatedStorageFile.GetUserStoreForApplication()”这样使用,这也是正确的解决方案。
    【解决方案2】:

    看看这里:Retrieving file path from IsolatedStorage

    isoStore.GetType.GetField("m_RootDir", Reflection.BindingFlags.NonPublic).GetValue(isoStore).ToString();
                                           ^ or Reflection.BindingFlags.Instance
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 2021-10-24
      • 1970-01-01
      • 2019-06-24
      • 1970-01-01
      • 2023-04-01
      相关资源
      最近更新 更多