Nested Stream Disposal

Viewed 686

Is it necessary to dispose of both streams, or will the stream reader dispose of the memory stream.

var btyeArray = Encoding.UTF8.GetBytes(DEFAULT_MAPPING_CSV);
using (var memStream = new MemoryStream(btyeArray))
{
    using (var streamReader = new StreamReader(memStream))
    {
        csvParser.Parse<EmployeeImportDTO>(streamReader, configuration);
    }
}

I know to be safe you should call both usings, but are both of them necessary?

0 Answers
Related