You have a Silverlight 4 application that uses isolated storage.
You create an application that h as a 5 MB file that must be saved to isolated storage. Currently, the application has not allocated enough isolated storage to save the file.
You need to ensure that the application prompts the user to increase the isolated storage allocation.
You also need to ensure that only the minimum amount of space needed to save the 5 MB file is requested. Which code segment should you use?
A.
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
var neededSpace = 5242880;
if (store.IncreaseQuotaTo(neededSpace))
{}}
B.
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
var neededSpace = 5242880;
if (store.IncreaseQuotaTo(store.Quota + neededSpace))
{}}
C.
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
var neededSpace = 5242880;
if (store.IncreaseQuotaTo(
store.AvailableFreeSpace + neededSpace
))
{}
}
D.
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
var neededSpace = 5242880;
if (store.IncreaseQuotaTo(
store.UsedSize + neededSpace
))
{}}
The correct answer must be B:
http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.increasequotato(v=vs.95).aspx
store.IncreaseQuotaTo(store.Quota + spaceToAdd)