Libation/Scraping/UNTESTED/Selectors/HtmlAgilityPackExt.cs
2019-10-04 16:14:04 -04:00

18 lines
514 B
C#

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using HtmlAgilityPack;
namespace Scraping.Selectors
{
internal static class HtmlAgilityPackExt
{
public static ReadOnlyCollection<WebElement> ToReadOnlyCollection(this IEnumerable<HtmlNode> nodeCollection)
=> (nodeCollection ?? new List<HtmlNode>())
.Select(n => new WebElement(n) as WebElement)
.ToList()
.AsReadOnly();
}
}