Class CategoryCollection
Represents a collection of Category classes.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 7.19.2Syntax
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. |