diff --git a/Src/Core/DBEngine/Management/ManagementServer.cs b/Src/Core/DBEngine/Management/ManagementServer.cs index a1e42eb..2aff00e 100644 --- a/Src/Core/DBEngine/Management/ManagementServer.cs +++ b/Src/Core/DBEngine/Management/ManagementServer.cs @@ -771,42 +771,10 @@ private void SaveConfiguration(object[] nodeConfiguration) private void WriteXMLToFile(string xml) { - System.IO.StreamWriter sw = null; - System.IO.FileStream fs = null; - try - { - fs = new System.IO.FileStream(_fileName, System.IO.FileMode.Create); - sw = new System.IO.StreamWriter(fs); - sw.Write(xml); - sw.Flush(); - } - catch (Exception e) - { - throw e; - } - finally - { - if (sw != null) - { - try - { - sw.Close(); - } - catch (Exception) - { } - sw.Dispose(); - sw = null; - } - if (fs != null) - { - try - { - fs.Close(); - } - catch (Exception) - { } - fs.Dispose(); - fs = null; + using(var fs = new System.IO.FileStream(_fileName, System.IO.FileMode.Create)) { + using(var sw = new System.IO.StreamWriter(fs)) { + sw.Write(xml); + sw.Flush(); } } }