Close reader after getting the inner XML from the file

This commit is contained in:
April P. committed 2024-12-18 13:43:06 -08:00
1 parent 7f8eabafb8
commit fd431b11c5
1 file changed
+6 -2
+6 -2
View File
@@ -45,7 +45,8 @@ public class Base
{
XDocument doc = XDocument.Parse(content);
XElement? root = doc.Root;
string innerXml;
if (root == null)
{
return String.Empty;
@@ -54,7 +55,10 @@ public class Base
XmlReader reader = root.CreateReader();
reader.MoveToContent();
return reader.ReadInnerXml();
innerXml = reader.ReadInnerXml();
reader.Close();
return innerXml;
}