Try our conversational search powered by Generative AI!

Class IndexedCollectionBase<T>

This type/member supports the EPiServer infrastructure and is not intended to be used directly from your code.

Base class for collections extending System.Collections.ReadOnlyCollectionBase with an an indexer on some string field.

Inheritance
System.Object
System.Collections.ReadOnlyCollectionBase
IndexedCollectionBase<T>
Implements
System.Collections.ICollection
System.Collections.IEnumerable
Inherited Members
System.Collections.ReadOnlyCollectionBase.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.ReadOnlyCollectionBase.GetEnumerator()
System.Collections.ReadOnlyCollectionBase.InnerList
System.Collections.ReadOnlyCollectionBase.Count
System.Collections.ReadOnlyCollectionBase.System.Collections.ICollection.IsSynchronized
System.Collections.ReadOnlyCollectionBase.System.Collections.ICollection.SyncRoot
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Data.Provider.Internal
Assembly: Mediachase.DataProvider.dll
Version: 10.8.0
Syntax
public abstract class IndexedCollectionBase<T> : ReadOnlyCollectionBase, ICollection, IEnumerable where T : class
Type Parameters
Name Description
T

The item type.

Constructors

IndexedCollectionBase(Func<T, String>)

Initializes a new instance of the IndexedCollectionBase<T> class using the default string comparer.

Declaration
protected IndexedCollectionBase(Func<T, string> keyAccessor)
Parameters
Type Name Description
System.Func<T, System.String> keyAccessor

Accessor for the key field on the item.

IndexedCollectionBase(Func<T, String>, IEqualityComparer<String>)

Initializes a new instance of the IndexedCollectionBase<T> class using the specified string comparer.

Declaration
protected IndexedCollectionBase(Func<T, string> keyAccessor, IEqualityComparer<string> keyComparer)
Parameters
Type Name Description
System.Func<T, System.String> keyAccessor

Accessor for the key field on the item.

System.Collections.Generic.IEqualityComparer<System.String> keyComparer

Comparer used for keys.

Properties

Item[Int32]

Gets the item at the specified index.

Declaration
public virtual T this[int index] { get; }
Parameters
Type Name Description
System.Int32 index

The index.

Property Value
Type Description
T

The requested item.

Item[String]

Gets the item with the specified name.

Declaration
public virtual T this[string key] { get; }
Parameters
Type Name Description
System.String key

The key for the item, extracted from the item as specifed in the constructor of this instance.

Property Value
Type Description
T

The requested item, or null if there is no match.

Methods

AddItem(T)

Adds the item to the collection.

Declaration
protected void AddItem(T item)
Parameters
Type Name Description
T item

The item.

Contains(T)

Determines whether the colleciton contains the specified item.

Declaration
public virtual bool Contains(T item)
Parameters
Type Name Description
T item

The item.

Returns
Type Description
System.Boolean

true if the colleciton contains a match; otherwise false.

Contains(String)

Determines whether the colleciton contains an item with the specified key.

Declaration
public virtual bool Contains(string key)
Parameters
Type Name Description
System.String key

The key for the item, extracted from the item as specifed in the constructor of this instance.

Returns
Type Description
System.Boolean

true if the colleciton contains a match; otherwise false.

IndexOf(T)

Gets the index of the item in the collection.

Declaration
public virtual int IndexOf(T item)
Parameters
Type Name Description
T item

The item.

Returns
Type Description
System.Int32

The index of the matching item, or -1 if there was no match.

IndexOf(String)

Gets the index the of the item with the specified key.

Declaration
public virtual int IndexOf(string key)
Parameters
Type Name Description
System.String key

The key for the item, extracted from the item as specifed in the constructor of this instance.

Returns
Type Description
System.Int32

The index of the matching item, or -1 if there was no match.

RemoveItem(T)

Removes the item from the collection.

Declaration
protected void RemoveItem(T item)
Parameters
Type Name Description
T item

The item.

RemoveItemAt(Int32)

Removes the item at the specified index.

Declaration
protected void RemoveItemAt(int index)
Parameters
Type Name Description
System.Int32 index

The index.

Implements

System.Collections.ICollection
System.Collections.IEnumerable

See Also

System.Collections.ReadOnlyCollectionBase