Either version works. If you want the simplest form then the second form is simpler. Because StreamReader
, by default, takes ownership of the stream then it will automatically close it when the reader is disposed (RAII).
Note that there is always a chance that the stream is opened and then creating and initializing the reader fails which leaves the stream open but given the reader does almost nothing this is not a realistic issue. But when using the RAII approach this is something to bear in mind.