/* INFINITY CODE 2013-2019 */
/* http://www.infinity-code.com */
using System.Collections;
#if !NETFX_CORE
using System.Xml;
#else
using Windows.Data.Xml.Dom;
#endif
namespace InfinityCode.RealWorldTerrain.XML
{
///
/// Wrapper for XmlNodeList.
///
public class RealWorldTerrainXMLList : IEnumerable
{
private readonly XmlNodeList _list;
///
/// Count of the elements.
///
public int count
{
get { return _list != null ? _list.Count : 0; }
}
///
/// Reference to XmlNodeList.
///
public XmlNodeList list
{
get { return _list; }
}
///
/// Create empty list.
///
public RealWorldTerrainXMLList()
{
}
///
/// Create wrapper for XmlNodeList.
///
/// XmlNodeList.
public RealWorldTerrainXMLList(XmlNodeList list)
{
_list = list;
}
///
/// Get the element by index.
///
/// Index of element.
/// Element.
public RealWorldTerrainXML this[int index]
{
get
{
if (_list == null || index < 0 || index >= _list.Count) return new RealWorldTerrainXML();
return new RealWorldTerrainXML(_list[index] as XmlElement);
}
}
public IEnumerator GetEnumerator()
{
for (int i = 0; i < count; i++)
{
yield return this[i];
}
}
}
}