Question:You need to read the entire contents of a file named Message.txt into a single string variable. Which code segment should you use? 

A String= result = nullptr;
StreamReader= reader = gcnew StreamReader("Message.txt");result = reader->ReadToEnd(); 

B String= result = nullptr;
StreamReader= reader = gcnew StreamReader("Message.txt"); result = reader->ReadLine(); 

C String= result = String::Empty;
StreamReader= reader = gcnew StreamReader("Message.txt");  while (!reader->EndOfStream) { result += reader->ToString();
}
 

D String= result = nullptr;
StreamReader= reader = gcnew StreamReader("Message.txt"); result = reader->Read().ToString(); 

+ Answer
+ Report
Total Preview: 661

Copyright © 2024. Powered by Intellect Software Ltd