mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-11 02:35:05 +00:00
refactor: Enumerate over XML attributes
This commit is contained in:
@@ -42,17 +42,11 @@ namespace ICD.Common.Utils.Xml
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
if (!extends.HasAttributes)
|
||||
return Enumerable.Empty<IcdXmlAttribute>();
|
||||
|
||||
List<IcdXmlAttribute> attributes = new List<IcdXmlAttribute>();
|
||||
while (extends.MoveToNextAttribute())
|
||||
attributes.Add(new IcdXmlAttribute(extends.Name, extends.Value));
|
||||
yield return new IcdXmlAttribute(extends.Name, extends.Value);
|
||||
|
||||
// Move back to element.
|
||||
extends.MoveToElement();
|
||||
|
||||
return attributes.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace ICD.Common.Utils.Xml
|
||||
using (IcdXmlReader reader = new IcdXmlReader(xml))
|
||||
{
|
||||
reader.ReadToNextElement();
|
||||
return reader.GetAttributes();
|
||||
return reader.GetAttributes().ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user