Microsoft Exam Questions

Which code segment should you use?

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
))
{}}