You are writing a method that accepts a string parameter named message. Your method must break the message parameter into individual lines of text and pass each line to
a second method named Process.
Which code segment should you use?
A. StringReader reader = new
StringReader(message);Process(reader.ReadToEnd());reader.Close();
B. StringReader reader = new StringReader(message);while (reader.Peek() != -1) {
string line = reader.Read().ToString();
Process(line);}reader.Close();
C. StringReader reader = new
StringReader(message);Process(reader.ToString());reader.Close();
D. StringReader reader = new StringReader(message);while (reader.Peek() != -1) {
Process(reader.ReadLine());}reader.Close();
Answer: D
a second method named Process.
Which code segment should you use?
A. StringReader reader = new
StringReader(message);Process(reader.ReadToEnd());reader.Close();
B. StringReader reader = new StringReader(message);while (reader.Peek() != -1) {
string line = reader.Read().ToString();
Process(line);}reader.Close();
C. StringReader reader = new
StringReader(message);Process(reader.ToString());reader.Close();
D. StringReader reader = new StringReader(message);while (reader.Peek() != -1) {
Process(reader.ReadLine());}reader.Close();
Answer: D
No comments:
Post a Comment