Which code segment should you use?

You are writing an application that uses isolated storage to store user preferences.
The application uses multiple assemblies.
Multiple users will use this application on the same computer.
You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly.
Which code segment should you use?

You are writing an application that uses isolated storage to store user preferences.
The application uses multiple assemblies.
Multiple users will use this application on the same computer.
You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly.
Which code segment should you use?

A.
IsolatedStrongFile store;
store = IsolatedStorageFile.GetUserStoreForAssembly();
store.CreateDirectory(“Preferences”);

B.
IsolatedStrongFile store;
store = IsolatedStorageFile.GetStoreForAssembly();
store.CreateDirectory(“Preferences”);

C.
IsolatedStrongFile store;
store = IsolatedStorageFile.GetUserStoreForDomain();
store.CreateDirectory(“Preferences”);

D.
IsolatedStrongFile store;
store = IsolatedStorageFile.GetMachineStoreForApplication();
store.CreateDirectory(“Preferences”);

Explanation:
The user store for the assembly is the correct store that is required. It is returned by IsolatedStorageFile.GetUserStoreForAssembly().
B,C & D return Isolated Storage File stores of incorrect scope



Leave a Reply 1

Your email address will not be published. Required fields are marked *