AngleSharp by Florian Rappl

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

.NET API 1,175,040 bytes

 HtmlTableRowElement

Represents the HTML tr element.
using AngleSharp.Dom.Collections; using AngleSharp.Dom.Css; using AngleSharp.Extensions; using AngleSharp.Html; namespace AngleSharp.Dom.Html { internal sealed class HtmlTableRowElement : HtmlElement, IHtmlTableRowElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle { private HtmlCollection<IHtmlTableCellElement> _cells; public HorizontalAlignment Align { get { return GetOwnAttribute(AttributeNames.Align).ToEnum(HorizontalAlignment.Left); } set { SetOwnAttribute(AttributeNames.Align, value.ToString()); } } public VerticalAlignment VAlign { get { return GetOwnAttribute(AttributeNames.Valign).ToEnum(VerticalAlignment.Middle); } set { SetOwnAttribute(AttributeNames.Valign, value.ToString()); } } public string BgColor { get { return GetOwnAttribute(AttributeNames.BgColor); } set { SetOwnAttribute(AttributeNames.BgColor, value); } } public IHtmlCollection<IHtmlTableCellElement> Cells => _cells ?? (_cells = new HtmlCollection<IHtmlTableCellElement>(this, false, null)); public int Index { get { IHtmlTableElement ancestor = this.GetAncestor<IHtmlTableElement>(); if (ancestor != null) return ancestor.Rows.Index(this); return -1; } } public int IndexInSection { get { IHtmlTableSectionElement htmlTableSectionElement = base.ParentElement as IHtmlTableSectionElement; if (htmlTableSectionElement != null) return htmlTableSectionElement.Rows.Index(this); return Index; } } public HtmlTableRowElement(Document owner, string prefix = null) : base(owner, Tags.Tr, prefix, NodeFlags.Special | NodeFlags.ImplicitelyClosed) { } public IHtmlTableCellElement InsertCellAt(int index = -1) { IHtmlTableCellElement htmlTableCellElement = Cells[index]; IHtmlTableCellElement htmlTableCellElement2 = base.Owner.CreateElement(Tags.Td) as IHtmlTableCellElement; if (htmlTableCellElement != null) InsertBefore(htmlTableCellElement2, htmlTableCellElement); else AppendChild(htmlTableCellElement2); return htmlTableCellElement2; } public void RemoveCellAt(int index) { if (index == -1) index = Cells.Length - 1; Cells[index]?.Remove(); } } }