Try our conversational search powered by Generative AI!

Class CategoryCollection

Represents a collection of Category classes.

Inheritance
System.Object
System.Collections.CollectionBase
CategoryCollection
Implements
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
Inherited Members
System.Collections.CollectionBase.Clear()
System.Collections.CollectionBase.RemoveAt(System.Int32)
System.Collections.CollectionBase.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.CollectionBase.System.Collections.IList.get_Item(System.Int32)
System.Collections.CollectionBase.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.CollectionBase.System.Collections.IList.Contains(System.Object)
System.Collections.CollectionBase.System.Collections.IList.Add(System.Object)
System.Collections.CollectionBase.System.Collections.IList.Remove(System.Object)
System.Collections.CollectionBase.System.Collections.IList.IndexOf(System.Object)
System.Collections.CollectionBase.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.CollectionBase.GetEnumerator()
System.Collections.CollectionBase.OnSet(System.Int32, System.Object, System.Object)
System.Collections.CollectionBase.OnInsert(System.Int32, System.Object)
System.Collections.CollectionBase.OnClear()
System.Collections.CollectionBase.OnRemove(System.Int32, System.Object)
System.Collections.CollectionBase.OnValidate(System.Object)
System.Collections.CollectionBase.OnSetComplete(System.Int32, System.Object, System.Object)
System.Collections.CollectionBase.OnInsertComplete(System.Int32, System.Object)
System.Collections.CollectionBase.OnClearComplete()
System.Collections.CollectionBase.OnRemoveComplete(System.Int32, System.Object)
System.Collections.CollectionBase.InnerList
System.Collections.CollectionBase.List
System.Collections.CollectionBase.Capacity
System.Collections.CollectionBase.Count
System.Collections.CollectionBase.System.Collections.IList.IsReadOnly
System.Collections.CollectionBase.System.Collections.IList.IsFixedSize
System.Collections.CollectionBase.System.Collections.ICollection.IsSynchronized
System.Collections.CollectionBase.System.Collections.ICollection.SyncRoot
System.Collections.CollectionBase.System.Collections.IList.Item[System.Int32]
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: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 7.19.2
Syntax
public class CategoryCollection : CollectionBase, IList, ICollection, IEnumerable
Remarks

You can use this class to iterate through categories from a given level, or add and delete categories. See the Category class for more information.

Constructors

CategoryCollection()

Initializes a new instance of the CategoryCollection class.

Declaration
public CategoryCollection()

CategoryCollection(Category)

Initializes a new instance of the CategoryCollection class.

Declaration
public CategoryCollection(Category owner)
Parameters
Type Name Description
Category owner

The parent category that the categories in this collection will be children of.

Properties

Item[Int32]

Gets or sets the Category associated with the specified index.

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

Methods

Add(Category)

Adds a Category to the end of the collection.

Declaration
public void Add(Category category)
Parameters
Type Name Description
Category category

The Category to be added to the end of the collection.

AddRange(CategoryCollection)

Adds a collection of objects to the end of the collection.

Declaration
public void AddRange(CategoryCollection categories)
Parameters
Type Name Description
CategoryCollection categories

The CategoryCollection to be added to the end of the collection.

Contains(Category)

Determines whether the collection contains a specific element.

Declaration
public bool Contains(Category category)
Parameters
Type Name Description
Category category

The Category to locate in the CollectionBase.

Returns
Type Description
System.Boolean

true if the collection contains the specified value; otherwise, false.

CopyTo(Category[], Int32)

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

Declaration
public void CopyTo(Category[] categories, int index)
Parameters
Type Name Description
Category[] categories

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

System.Int32 index

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

IndexOf(Category)

Searches for the specified Category and returns the zero-based index of the first occurrence within the entire collection.

Declaration
public int IndexOf(Category category)
Parameters
Type Name Description
Category category

The Category to locate in the CollectionBase.

Returns
Type Description
System.Int32

The zero-based index of the first occurrence of value within the entire collection, if found; otherwise, -1.

Insert(Int32, Category)

Inserts an element into the collection at the specified index.

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

The zero-based index at which value should be inserted.

Category category

The Category to insert.

Remove(Category)

Removes the first occurrence of a specific Category from the collection.

Declaration
public void Remove(Category category)
Parameters
Type Name Description
Category category

The Category to remove from the collection.

Implements

System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable

Extension Methods