开发者

change file name Isolated Storage windows phone 7

开发者 https://www.devze.com 2023-02-04 13:04 出处:网络
i would like when i create a file in the IO by using the StreamWriter something like streamReaderLOL = new StreamReader(

i would like when i create a file in the IO by using the StreamWriter something like

streamReaderLOL = new StreamReader(
  new IsolatedStorageFileStream("test\\parameter.txt", FileMode.Open, UserPlace)); 

where parameter is a variab开发者_开发问答le i have try smth like

"test\\"+parameter".txt" etc but seems not to work.

so my question is : is it possible ?

ty a lot


Using "test\\" + parameter + ".txt" should be absolutely fine. It's only constructing a string to pass in as the arugment, after all.


If you want to use a directory within IsolatedStorage you must first create the directory before trying to use it.

using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
    if (!isoStore.DirectoryExists("test"))
    {
        isoStore.CreateDirectory("test");
    }

    isoStore.CreateFile("test\\" + param + ".txt");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消