November Happy Hour will be moved to Thursday December 5th.

Class ItemCollection<T>

Base class for collections used as values in properties.

Inheritance
System.Object
ItemCollection<T>
Implements
System.ICloneable
System.Collections.IList
System.Collections.ICollection
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
EPiServer.Data.Entity.IReadOnly<ItemCollection<T>>
EPiServer.Data.Entity.IReadOnly
Inherited Members
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: EPiServer.Commerce.SpecializedProperties
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0
Syntax
public class ItemCollection<T> : ICloneable, IList, ICollection, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IReadOnly<ItemCollection<T>>, IReadOnly where T : ICloneable
Type Parameters
Name Description
T

The item type.

Constructors

ItemCollection()

Initializes a new instance of the ItemCollection<T> class.

Declaration
public ItemCollection()

ItemCollection(IEnumerable<T>)

Initializes a new instance of the ItemCollection<T> class.

Declaration
public ItemCollection(IEnumerable<T> items)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> items

The items.

Exceptions
Type Condition
System.ArgumentNullException

items

Properties

Count

Gets the item count.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

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

Gets a value indicating whether this instance is read only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

Item[Int32]

Gets or sets the item at the specified index.

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

The zero-based index of the element to get or set.

Property Value
Type Description
T

Methods

Add(T)

Adds the specified item.

Declaration
public void Add(T item)
Parameters
Type Name Description
T item

The item.

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(T)

Determines whether an element is in the collection.

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

The item.

Returns
Type Description
System.Boolean

true if the item is found otherwise, false.

CopyTo(T[], Int32)

Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array.

Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type Name Description
T[] array

The one-dimensional System.Array that is the destination of the elements copied from collection. The System.Array must have zero-based indexing.

System.Int32 arrayIndex

The zero-based index in array at which copying begins.

CreateWritableClone()

Creates a writable clone of the current instance.

Declaration
public ItemCollection<T> CreateWritableClone()
Returns
Type Description
ItemCollection<T>

A new object that is a copy of this instance and that is writeable.

GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>

An System.Collections.IEnumerator object that can be used to iterate through the collection.

IndexOf(T)

Gets the index of the item in the collection.

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

The item.

Returns
Type Description
System.Int32

The index of item if found in the collection; otherwise, -1.

Insert(Int32, T)

Inserts the item at the specified index.

Declaration
public void Insert(int index, T item)
Parameters
Type Name Description
System.Int32 index

The zero-based index.

T item

The item.

MakeReadOnly()

Makes the instance read only.

Declaration
public void MakeReadOnly()

Remove(T)

Removes the specified item.

Declaration
public bool Remove(T item)
Parameters
Type Name Description
T item

The item.

Returns
Type Description
System.Boolean

true if success; otherwise false

RemoveAt(Int32)

Removes the item at the specified index.

Declaration
public void RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the item to remove.

ThrowIfReadOnly()

Throws an exception if the instance is read only.

Declaration
protected void ThrowIfReadOnly()

ToString()

Gets a string representation of the items by joining them together, using a comma as a separator.

Declaration
public override string ToString()
Returns
Type Description
System.String

A comma separated string of the items in the collection.

Overrides
System.Object.ToString()

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
Type Name Description
System.Array array
System.Int32 index

ICollection.Count

Declaration
int ICollection.Count { get; }
Returns
Type Description
System.Int32

ICollection.IsSynchronized

Declaration
bool ICollection.IsSynchronized { get; }
Returns
Type Description
System.Boolean

ICollection.SyncRoot

Declaration
object ICollection.SyncRoot { get; }
Returns
Type Description
System.Object

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

An System.Collections.IEnumerator object that can be used to iterate through the collection.

IList.Add(Object)

Declaration
int IList.Add(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Int32

IList.Clear()

Declaration
void IList.Clear()

IList.Contains(Object)

Declaration
bool IList.Contains(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Boolean

IList.get_Item(Int32)

Declaration
object IList.get_Item(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
System.Object

IList.IndexOf(Object)

Declaration
int IList.IndexOf(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Int32

IList.Insert(Int32, Object)

Declaration
void IList.Insert(int index, object value)
Parameters
Type Name Description
System.Int32 index
System.Object value

IList.IsFixedSize

Declaration
bool IList.IsFixedSize { get; }
Returns
Type Description
System.Boolean

IList.IsReadOnly

Declaration
bool IList.IsReadOnly { get; }
Returns
Type Description
System.Boolean

IList.Item[Int32]

Declaration
object IList.this[] { get; set; }
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
System.Object

IList.Remove(Object)

Declaration
void IList.Remove(object value)
Parameters
Type Name Description
System.Object value

IList.RemoveAt(Int32)

Declaration
void IList.RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index

IList.set_Item(Int32, Object)

Declaration
void IList.set_Item(int index, object value)
Parameters
Type Name Description
System.Int32 index
System.Object value

Implements

System.ICloneable
System.Collections.IList
System.Collections.ICollection
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
EPiServer.Data.Entity.IReadOnly<>
EPiServer.Data.Entity.IReadOnly