XhtmlLinkCollection
A collection of XHTML links that prevents duplicate hreflang values. Used to manage alternate language versions for a sitemap URL.
Implements: ICollection<XhtmlLink>, IEnumerable<XhtmlLink>, IEnumerable
Properties
public int Count { get; }
value = xhtmlLinkCollection.Count
Gets the number of XHTML links in the collection.
public bool IsReadOnly { get; }
value = xhtmlLinkCollection.IsReadOnly
Gets a value indicating whether the collection is read-only.
Methods
public void Add(XhtmlLink item)
xhtmlLinkCollection.Add(item)
Adds an XHTML link to the collection. If a link with the same hreflang already exists, it will be replaced.
- item
- The XHTML link to add.
public bool Contains(XhtmlLink item)
result = xhtmlLinkCollection.Contains(item)
Determines whether the collection contains a specific XHTML link.
- item
- The XHTML link to locate.
Returns: true if the link is found; otherwise, false.
public bool ContainsHreflang(string hreflang)
result = xhtmlLinkCollection.ContainsHreflang(hreflang)
Determines whether the collection contains a link with the specified hreflang.
- hreflang
- The language code to search for.
Returns: true if a link with the specified hreflang is found; otherwise, false.
public void CopyTo(XhtmlLink[] array, int arrayIndex)
xhtmlLinkCollection.CopyTo(array, arrayIndex)
Copies the XHTML links to an Array, starting at a particular Array index.
- array
- The destination array.
- arrayIndex
- The zero-based index in array at which copying begins.
public IEnumerator<XhtmlLink> GetEnumerator()
result = xhtmlLinkCollection.GetEnumerator()
Returns an enumerator that iterates through the collection.
Returns: An enumerator for the collection.
public bool Remove(XhtmlLink item)
result = xhtmlLinkCollection.Remove(item)
Removes the first occurrence of a specific XHTML link from the collection.
- item
- The XHTML link to remove.
Returns: true if the link was successfully removed; otherwise, false.
public bool RemoveHreflang(string hreflang)
result = xhtmlLinkCollection.RemoveHreflang(hreflang)
Removes the XHTML link with the specified hreflang from the collection.
- hreflang
- The language code of the link to remove.
Returns: true if the link was successfully removed; otherwise, false.
System#Collections#IEnumerable#GetEnumerator()
Returns an enumerator that iterates through the collection.
Returns: An enumerator for the collection.
public bool TryGetLink(string hreflang, XhtmlLink link)
result = xhtmlLinkCollection.TryGetLink(hreflang, link)
Gets the XHTML link with the specified hreflang.
- hreflang
- The language code to search for.
- link
- When this method returns, contains the XHTML link with the specified hreflang, if found; otherwise, null.
Returns: true if a link with the specified hreflang is found; otherwise, false.