Choose the code segment which will achieve your goal.

You work as the application developer at Domain.com.
You are creating a new code segment.
You must ensure that the data contained within an isolated storage file, named Settings.dat, is returned as a string.
Settings.dat is machine-scoped.
Choose the code segment which will achieve your goal.

You work as the application developer at Domain.com.
You are creating a new code segment.
You must ensure that the data contained within an isolated storage file, named Settings.dat, is returned as a string.
Settings.dat is machine-scoped.
Choose the code segment which will achieve your goal.

A.
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream( “Settings.dat”, FileMode.Open);
string result = new StreamReader(isoStream).ReadToEnd();

B.
IsolatedStorageFile isoFile;
isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream(“Settings.dat”, FileMode.Open, isoFile);
string result = new StreamReader(isoStream).ReadToEnd();

C.
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream( “Settings.dat”, FileMode.Open);
string result = isoStream.ToString();

D.
IsolatedStorageFile isoFile;
isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream(“Settings.dat”, FileMode.Open, isoFile);
string result = isoStream.ToString();

Explanation:
Retrieve the IsolatedStorageFile for the machine store. Use an IsolatedStorageFileStream to read from the desired file within the machine store. A & C do not get the IsolatedStorageFile for the machine context. D returns a string representation of the IsolatedStorageFileStream object not a String of the files contents as the question requests.



Leave a Reply 1

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


seenagape

seenagape

I choose B