Class LinkItemCollection
Property that is used to store multiple html links.
Inheritance
Implements
Namespace: EPiServer.SpecializedProperties
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public class LinkItemCollection : Object, IList<LinkItem>, ICollection<LinkItem>, IEnumerable<LinkItem>, IEnumerable, IReadOnly<LinkItemCollection>, IReadOnly, ICloneable, IReferenceMap, IEquatable<LinkItemCollection>
Constructors
LinkItemCollection()
Initializes a new instance of the LinkItemCollection class.
Declaration
public LinkItemCollection()
LinkItemCollection(IEnumerable<LinkItem>)
Initializes a new instance of the LinkItemCollection class.
Declaration
public LinkItemCollection(IEnumerable<LinkItem> links)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<LinkItem> | links |
Properties
Count
Gets the link count.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The link count. |
IsModified
Gets or sets a value indicating whether this instance is modified.
Declaration
public bool IsModified { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
IsReadOnly
Indicates if the current object instance is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | True if the property is read only; otherwise false. |
Item[Int32]
Gets the LinkItem at the specified index.
Declaration
public LinkItem this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Property Value
| Type | Description |
|---|---|
| LinkItem | The LinkItem at the specified index. |
ReferencedPermanentLinkIds
Gets an System.Collections.Generic.IList<> of permanent link ids that are referenced from this property.
Declaration
public virtual IList<Guid> ReferencedPermanentLinkIds { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IList<System.Guid> | An System.Collections.Generic.IList<> of permanent link ids that are referenced from this property. |
Methods
Add(LinkItem)
Adds the specified link.
Declaration
public void Add(LinkItem link)
Parameters
| Type | Name | Description |
|---|---|---|
| LinkItem | link | The link. |
Add(Int32, LinkItem)
Adds a link at the specified index.
Declaration
public void Add(int index, LinkItem link)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index. |
| LinkItem | link | The link. |
AddRange(LinkItemCollection)
Adds a collection of links.
Declaration
public void AddRange(LinkItemCollection linkCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| LinkItemCollection | linkCollection | The link collection to add. |
Clear()
Clears this instance.
Declaration
public void Clear()
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new object that is a copy of this instance. |
Contains(LinkItem)
/// Determines whether an element is in the list.
Declaration
public bool Contains(LinkItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| LinkItem | item | The item |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if item is found in the list; otherwise, false. |
CopyTo(LinkItem[], Int32)
Copies the entire list to a compatible one-dimensional array, starting at the specified index of the target array.
Declaration
public void CopyTo(LinkItem[] array, int arrayIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| LinkItem[] | array | The one-dimensional System.Array that is the destination of the elements copied from list. The System.Array must have zero-based indexing. |
| System.Int32 | arrayIndex | The zero-based index in array at which copying begins. |
CreateWritableClone()
Create a copy of the current object instance that is writable.
Declaration
public LinkItemCollection CreateWritableClone()
Returns
| Type | Description |
|---|---|
| LinkItemCollection | A new copy of the object. |
Remarks
The cloning is a deep-copy.
Equals(LinkItemCollection)
Declaration
public bool Equals(LinkItemCollection other)
Parameters
| Type | Name | Description |
|---|---|---|
| LinkItemCollection | other |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Equals(Object)
Determines whether the specified System.Object is equal to this instance. It will do so by matching the order and the content of all LinkItems in the LinkItemCollection.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The System.Object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| System.NullReferenceException | The |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<LinkItem> GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerator<LinkItem> | A System.Collections.Generic.IEnumerator<> that can be used to iterate through the collection. |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
IndexOf(LinkItem)
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the list that starts at the specified index and contains the specified number of elements.
Declaration
public int IndexOf(LinkItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| LinkItem | item | The item. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The zero-based index of the first occurrence of item within the range of elements in the list that extends from index to the last element, if found; otherwise, –1. |
Insert(Int32, LinkItem)
Inserts an element into the Slist at the specified index.
Declaration
public void Insert(int index, LinkItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index. |
| LinkItem | item | The item. |
MakeReadOnly()
Changes the object instance into a read-only object.
Declaration
public void MakeReadOnly()
Remarks
After calling this method, any attempt to change the object instance or any contained object will generate a System.NotSupportedException. I e the semantics is "deep read-only".
Note! After setting an object to read-only it is not possible to revert back to read-write mode. You will have to call the CreateWritableClone method to get a copy that can be modified.
RemapPermanentLinkReferences(IDictionary<Guid, Guid>)
Remaps permanent links according to the provided link mapping.
Declaration
public virtual void RemapPermanentLinkReferences(IDictionary<Guid, Guid> idMap)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IDictionary<System.Guid, System.Guid> | idMap | The link mapping. |
Remove(LinkItem)
Removes the specified link.
Declaration
public bool Remove(LinkItem link)
Parameters
| Type | Name | Description |
|---|---|---|
| LinkItem | link | The link. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if success; otherwise false |
RemoveAt(Int32)
Removes the link at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index. |
ThrowIfReadOnly()
Throws an exception if called upon if this instance is set to read only.
Declaration
protected void ThrowIfReadOnly()
ToString()
Returns an unordered list containing the links.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | An unordered list containing the links. |
Explicit Interface Implementations
IReadOnly.CreateWritableClone()
Creates writable clone of this object.
Declaration
object IReadOnly.CreateWritableClone()
Returns
| Type | Description |
|---|---|
| System.Object | Writable clone object. |