Bird
0
0

What is the primary purpose of the StreamReader class in C#?

easy🧠 Conceptual Q11 of 15
C Sharp (C#) - File IO
What is the primary purpose of the StreamReader class in C#?
ATo read text from a file
BTo write text to a file
CTo create a new file
DTo delete a file
Step-by-Step Solution
Solution:
  1. Step 1: Understand StreamReader's role

    StreamReader is designed to read text data from files.
  2. Step 2: Differentiate from StreamWriter

    StreamWriter writes text, not reads it.
  3. Final Answer:

    To read text from a file -> Option A
  4. Quick Check:

    StreamReader reads files = D [OK]
Quick Trick: StreamReader reads, StreamWriter writes [OK]
Common Mistakes:
MISTAKES
  • Confusing StreamReader with StreamWriter
  • Thinking StreamReader creates files
  • Assuming StreamReader deletes files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes