You need to return the contents of an isolated storage file as a string. The file is machine-scoped and is named Settings.dat. Which code segment should you use?

You need to return the contents of an isolated storage file as a string. The file is machine-scoped
and is named Settings.dat. Which code segment should you use?


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();


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();

Answer: B 

No comments:

Post a Comment