mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
refactor: Enumerate over XML attributes
This commit is contained in:
parent
e0176741d2
commit
f53607018c
2 changed files with 2 additions and 8 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue