Search code examples
c#isolatedstorage

not able to get files when there is more than one isolated storage folder


I have 2 isolated storage folder for my admin user,

enter image description here

In top folder I have a file which I want to grab. I'm using below code to calculate the path for Isolated Storage,

var path = IsolatedStorageFile.GetUserStoreForAssembly().GetType().GetField("m_RootDir", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(IsolatedStorageFile.GetUserStoreForAssembly()).ToString()

Now this will always give me path for bottom folder (picture above) whereas my file reside under top folder.

Is there other way to grab the path?


Solution

  • It is not a good idea to use reflection for getting files.
    This document may be helpful : How to: Find Existing Files and Directories in Isolated Storage | Microsoft Docs