As MemoryStream is an unmanaged resource does it always have to be disposed?
Given:
1) A method is invoked.
2) A MemoryStream object is created (MemoryStream ms = new MemoryStream();).
3) An exception occurs and is caught from the invoking classes.
The reference on the MemoryStream object is therefore lost. Does this scenario need a try/finally-block (or using-statement)?
See Question&Answers more detail:os