Skip to content
Browse files

Array indexing of BBCodeNodes

  • Loading branch information...
1 parent fe254a0 commit 0ae0af769ac7887c5b97d04d433ccfc24d8d128f @charliesome committed May 8, 2010
Showing with 25 additions and 0 deletions.
  1. +25 −0 BBCodeNode.cs
View
25 BBCodeNode.cs
@@ -33,6 +33,31 @@ public class BBCodeNode
public string Attribute { get; set; }
/// <summary>
+ /// Gets an array of children BBCodeNodes with the specified TagName
+ /// </summary>
+ /// <param name="TagName">The TagName of BBCodeNodes to return</param>
+ /// <returns>Array of matching BBCodeNodes</returns>
+ public BBCodeNode[] this[string TagName]
+ {
+ get
+ {
+ return children.Where(x => x.TagName == TagName).ToArray();
+ }
+ }
+ /// <summary>
+ /// Gets the nth child BBCodeNode
+ /// </summary>
+ /// <param name="Index">The index of the BBCodeNode to access</param>
+ /// <returns>BBCodeNode at the specified index</returns>
+ public BBCodeNode this[int Index]
+ {
+ get
+ {
+ return children[Index];
+ }
+ }
+
+ /// <summary>
/// Creates a new BBCodeNode.
/// </summary>
/// <param name="TagName">The node's tag name. Mandatory.</param>

0 comments on commit 0ae0af7

Please sign in to comment.
Something went wrong with that request. Please try again.