Take the 2-minute tour ×

I'm trying to get containers for my app settings and files and i found this code in Microsoft Website

Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
Windows.Storage.ApplicationDataContainer localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

but when i paste it to my code it give me an Error

enter image description here

anyone know what is the error ? how can i solve it ?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

LocalFolder isn't a storage container, its a storage folder. Wouldn't something like this work better?

Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

share|improve this answer
add comment

The property you are accessing returns an object of type StorageFolder (as documented on the same MS webpage where you found an incorrect example). So, just change the type of localFolder as appropriate.

Don't trust examples, they often contain errors for the first several years after publishing. Also, learn to read and understand error messages. The error you posted explicitly says what's wrong and how to fix it.

share|improve this answer
add comment


That is definitely wrong; .LocalFolder returns a StorageFolder (and always has).

Where'd you find that on Microsoft's website? Can you share the URL?

share|improve this answer
yup of course , this is the URL msdn.microsoft.com/en-us/library/windows/apps/xaml/… –  Ahmed Ali Aug 6 '12 at 1:06
add comment

Your Answer


