Class HtmlAttributeCollection
- Namespace
- HtmlAgilityPack
- Assembly
- HtmlAgilityPack.dll
Represents a combined list and collection of HTML nodes.
public class HtmlAttributeCollection : IList<HtmlAttribute>, ICollection<HtmlAttribute>, IEnumerable<HtmlAttribute>, IEnumerable- Inheritance
- 
      
      HtmlAttributeCollection
- Implements
- Inherited Members
Properties
Count
Gets the number of elements actually contained in the list.
public int Count { get; }Property Value
IsReadOnly
Gets readonly status of colelction
public bool IsReadOnly { get; }Property Value
this[int]
Gets the attribute at the specified index.
public HtmlAttribute this[int index] { get; set; }Parameters
- indexint
Property Value
this[string]
Gets a given attribute from the list using its name.
public HtmlAttribute this[string name] { get; set; }Parameters
- namestring
Property Value
Methods
Add(HtmlAttribute)
Adds supplied item to collection
public void Add(HtmlAttribute item)Parameters
- itemHtmlAttribute
Add(string, string)
Adds a new attribute to the collection with the given values
public void Add(string name, string value)Parameters
Append(HtmlAttribute)
Inserts the specified attribute as the last attribute in the collection.
public HtmlAttribute Append(HtmlAttribute newAttribute)Parameters
- newAttributeHtmlAttribute
- The attribute to insert. May not be null. 
Returns
- HtmlAttribute
- The appended attribute. 
Append(string)
Creates and inserts a new attribute as the last attribute in the collection.
public HtmlAttribute Append(string name)Parameters
- namestring
- The name of the attribute to insert. 
Returns
- HtmlAttribute
- The appended attribute. 
Append(string, string)
Creates and inserts a new attribute as the last attribute in the collection.
public HtmlAttribute Append(string name, string value)Parameters
Returns
- HtmlAttribute
- The appended attribute. 
AttributesWithName(string)
Returns all attributes with specified name. Handles case insentivity
public IEnumerable<HtmlAttribute> AttributesWithName(string attributeName)Parameters
- attributeNamestring
- Name of the attribute 
Returns
Contains(HtmlAttribute)
Retreives existence of supplied item
public bool Contains(HtmlAttribute item)Parameters
- itemHtmlAttribute
Returns
Contains(string)
Checks for existance of attribute with given name
public bool Contains(string name)Parameters
- namestring
Returns
CopyTo(HtmlAttribute[], int)
Copies collection to array
public void CopyTo(HtmlAttribute[] array, int arrayIndex)Parameters
- arrayHtmlAttribute[]
- arrayIndexint
IndexOf(HtmlAttribute)
Retrieves the index for the supplied item, -1 if not found
public int IndexOf(HtmlAttribute item)Parameters
- itemHtmlAttribute
Returns
Insert(int, HtmlAttribute)
Inserts given item into collection at supplied index
public void Insert(int index, HtmlAttribute item)Parameters
- indexint
- itemHtmlAttribute
Prepend(HtmlAttribute)
Inserts the specified attribute as the first node in the collection.
public HtmlAttribute Prepend(HtmlAttribute newAttribute)Parameters
- newAttributeHtmlAttribute
- The attribute to insert. May not be null. 
Returns
- HtmlAttribute
- The prepended attribute. 
Remove()
Removes all attributes from the collection
public void Remove()Remove(HtmlAttribute)
Removes a given attribute from the list.
public void Remove(HtmlAttribute attribute)Parameters
- attributeHtmlAttribute
- The attribute to remove. May not be null. 
Remove(string)
Removes an attribute from the list, using its name. If there are more than one attributes with this name, they will all be removed.
public void Remove(string name)Parameters
- namestring
- The attribute's name. May not be null. 
RemoveAll()
Remove all attributes in the list.
public void RemoveAll()RemoveAt(int)
Removes the attribute at the specified index.
public void RemoveAt(int index)Parameters
- indexint
- The index of the attribute to remove.