Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add indexor to simplify access to child tag content e.g. person["Firs…

…tName"]
  • Loading branch information...
commit a62ffada4cbd6a6ad52122051d00c8deab0090ff 1 parent cf2cd3e
@handcraftsman handcraftsman authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/LinqToHtml/HTMLTag.cs
View
13 src/LinqToHtml/HTMLTag.cs
@@ -71,6 +71,19 @@ public IEnumerable<HTMLTag> DescendantTags
}
}
+ public string this [string key]
+ {
+ get
+ {
+ var child = ChildTags.FirstOrDefault(x => x.Type == key);
+ if (child == null)
+ {
+ return null;
+ }
+ return child.Content;
+ }
+ }
+
public HTMLTag Parent
{
get { return new HTMLTag(_node.ParentNode); }
Please sign in to comment.
Something went wrong with that request. Please try again.