I’m taking a practice test for the exam 70-536. Below is a screenshot. The yellow highlighted is what the exam says is the correct answer. The one with the radio button selected is the answer I thought it was.
Note the explanation at the bottom which includes the statement:
To create a
StreamWriterobject, you must use an existingStreamobject, such as an instance ofFileStream.
I think the answer I chose is the most efficient use and I think the statement made in the explanation is wrong. Clearly, because the code in my selected answer worked fine.
Who’s right????

In the answer you choose there’s a difference between the C# and VB.NET version. The VB.NET version won’t even compile whereas the C# is correct.
This won’t compile:
This is OK:
The last answer is out of the question because TextWriter is an abstract class and you cannot instantiate it directly.
But obviously the correct answer which is what you would use in a real world application is not even present in the list. It would be:
or if you need to use a
Stream: