public void Dispose() { if (m_Stream != null) { if (!m_ReadOuter) { if (m_Outer != null) { byte[] array = ((MemoryStream)m_Stream).ToArray(); m_Outer.Write_Header(m_OuterId, EntryType.TLV, array.Length); m_Outer.m_Stream.Write(array, 0, array.Length); m_Outer = null; } m_Stream.Dispose(); } else { byte[] readdata; TryReadData(m_MaxLength, out readdata); } } m_Stream = null; }