public void Dispose() { if (m_stream == null) { return; } var writer = new StreamWriter(m_stream, Encoding.UTF8); m_item.WriteTo(writer); if (m_disposeStream) { writer.Close(); } else { writer.Flush(); } }