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
Implements
Inherited Members
Namespace: Mediachase.Data.Provider.Internal
Assembly: Mediachase.DataProvider.dll
Version: 12.17.2Syntax
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 |
|
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 |
|
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. |