From c7baee16380d67cecf7397258820eb50e2968eca Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 14 Jul 2018 14:05:47 +0100
Subject: add using into a few more places
---
OpenSim/Capabilities/LLSD.cs | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Capabilities/LLSD.cs')
diff --git a/OpenSim/Capabilities/LLSD.cs b/OpenSim/Capabilities/LLSD.cs
index 76e439f..342164d 100644
--- a/OpenSim/Capabilities/LLSD.cs
+++ b/OpenSim/Capabilities/LLSD.cs
@@ -107,17 +107,17 @@ namespace OpenSim.Framework.Capabilities
///
public static byte[] LLSDSerialize(object obj)
{
- StringWriter sw = new StringWriter();
- XmlTextWriter writer = new XmlTextWriter(sw);
- writer.Formatting = Formatting.None;
-
- writer.WriteStartElement(String.Empty, "llsd", String.Empty);
- LLSDWriteOne(writer, obj);
- writer.WriteEndElement();
-
- writer.Close();
+ using(StringWriter sw = new StringWriter())
+ using(XmlTextWriter writer = new XmlTextWriter(sw))
+ {
+ writer.Formatting = Formatting.None;
- return Util.UTF8.GetBytes(sw.ToString());
+ writer.WriteStartElement(String.Empty, "llsd", String.Empty);
+ LLSDWriteOne(writer, obj);
+ writer.WriteEndElement();
+ writer.Flush();
+ return Util.UTF8.GetBytes(sw.ToString());
+ }
}
///
--
cgit v1.1