AngleSharp by AngleSharp

<PackageReference Include="AngleSharp" Version="0.17.0" />

.NET API 882,176 bytes

 HtmlAllCollection

A general collection for all elements of type IElement.
using AngleSharp.Common; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; namespace AngleSharp.Dom { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] internal sealed class HtmlAllCollection : IHtmlAllCollection, IHtmlCollection<IElement>, IEnumerable<IElement>, IEnumerable { private readonly IEnumerable<IElement> _elements; public IElement this[int index] { get { return _elements.GetItemByIndex(index); } } [System.Runtime.CompilerServices.Nullable(2)] public IElement this[string id] { [return: System.Runtime.CompilerServices.Nullable(2)] get { return _elements.GetElementById(id); } } public int Length => _elements.Count(); public HtmlAllCollection(IDocument document) { _elements = document.GetNodes<IElement>(true, null); } public IEnumerator<IElement> GetEnumerator() { return _elements.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _elements.GetEnumerator(); } } }