I\'m going to convert array of bytes to System.Windows.Media.Imaging.BitmapImage and show the BitmapImage in an image control.
When I\'m u
In the first case, you defined your MemoryStream in a using block, which causes the object to be disposed when you go out of the block. So you return a BitmapImage with a disposes (and non-existing) stream.
MemoryStreams keep no unmanaged resources, so you can leave the memory and let the GC handle the freeing process (but that's not a good practice).