简体   繁体   中英

Saving multiple files simultaneously to isolated storage on WP7

I have N number of files to written to isolated storage, is this best done in a sequential manner or can it be asynchronously (eg max 3 in parallel)?

I know how I do this, I wanted to know if this is a bad idea etc...

You can't physically save two files simultaneously. You only have one processor that can only do one thing at a time, and since the file eventually gets written to Flash, which has a controller that can only write one sector at a time anyway, all writes end up serialized at some point. I'm sure that there's thread safety down in the depths of the file system code that is going to handle multiple write calls just fine, but I don't think you're going to gain any performance by trying to write files in parallel.

Do you have the files in memory, or are you downloading them from somewhere? If the files are in memory, then see ctacke's answer. If you're downloading them, it might make sense to save them to isolated storage asynchronously rather than wait for each download to complete before starting the next one. In that case, it really depends on whether they can be downloaded simultaneously.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM