switch to usings

This commit is contained in:
Luke Pulverenti 2016-10-27 17:57:00 -04:00
parent b5b3d8a30c
commit 0d5e95222a

View File

@ -55,7 +55,8 @@ namespace XmlRpcHandler
using (var ms = new MemoryStream())
{
XmlWriter XMLwrt = XmlWriter.Create(ms, sett);
using (XmlWriter XMLwrt = XmlWriter.Create(ms, sett))
{
// Let's write the methods
foreach (XmlRpcMethodCall method in methods)
{
@ -87,10 +88,10 @@ namespace XmlRpcHandler
XMLwrt.WriteEndElement();//methodCall
}
XMLwrt.Flush();
XMLwrt.Close();
return ms.ToArray();
}
}
}
/// <summary>
/// Decode response then return the values
/// </summary>
@ -107,8 +108,8 @@ namespace XmlRpcHandler
{
str = new MemoryStream(Encoding.UTF8.GetBytes(xmlResponse));
}
XmlReader XMLread = XmlReader.Create(str, sett);
using (XmlReader XMLread = XmlReader.Create(str, sett))
{
XmlRpcMethodCall call = new XmlRpcMethodCall("methodResponse");
// Read parameters
while (XMLread.Read())
@ -121,9 +122,9 @@ namespace XmlRpcHandler
}
}
methods.Add(call);
XMLread.Close();
return methods.ToArray();
}
}
private static void WriteBasicValue(XmlWriter XMLwrt, XmlRpcValueBasic val)
{