You are developing an application that will read data from a text file and display the file contents.
You need to read data from the file, display it, and correctly release the file resources.
Which code segment should you use?

A.
Option A
B.
Option B
C.
Option C
D.
Option D
A
0
0
it cant be A.
0
1
has to be D. the dispose main purpose is to clean up unmanaged resources (resources outside the control of the CLR)
0
1
True, but the dispose should have been called in the finally block not at the end of the try block since we might not reach it. Aka it’s the main reason the reader has been declared outside of the try block so it could be accessed in the finally.
It’s A
a using statement can only be used when the class implements IDisposable interface, the benefit is once we go outside of the using the object is automatically disposed.
3
0
A is correct because it use using statement for a StreamReader.
0
0
A
2
0