Class CategoryCollection
Represents a collection of Category instances.
Inheritance
Implements
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public class CategoryCollection : Object, IList<Category>, ICollection<Category>, IEnumerable<Category>, IEnumerable, IReadOnly<CategoryCollection>, IReadOnly, IList, ICollection
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 Category
Declaration
public CategoryCollection()
CategoryCollection(Category)
Initializes a new instance of the Category
Declaration
public CategoryCollection(Category parent)
Parameters
Type | Name | Description |
---|---|---|
Category | parent | The parent category that the categories in this collection will be children of. |
Properties
Count
Gets the number of categories contained in the Category
Declaration
public virtual int Count { get; }
Property Value
Type | Description |
---|---|
System. |
IsReadOnly
Gets a value indicating whether the Category
Declaration
public virtual bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System. |
Item[Int32]
Gets or sets the category at the specified index.
Declaration
public virtual Category this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System. |
index | The index of the Category to access. |
Property Value
Items
Gets direct access to a list of the contained categories.
Declaration
protected IList<Category> Items { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
Add(Category)
Adds a category to the Category
Declaration
public virtual void Add(Category item)
Parameters
Type | Name | Description |
---|---|---|
Category | item | The category to add to the Category |
AddRange(IEnumerable<Category>)
Adds a range of categories to the Category
Declaration
public virtual void AddRange(IEnumerable<Category> items)
Parameters
Type | Name | Description |
---|---|---|
System. |
items | The categories to add. |
Exceptions
Type | Condition |
---|---|
System. |
items |
Clear()
Removes all categories from the Category
Declaration
public virtual void Clear()
Contains(Category)
Determines whether the Category
Declaration
public virtual bool Contains(Category item)
Parameters
Type | Name | Description |
---|---|---|
Category | item | The category to locate in the Category |
Returns
Type | Description |
---|---|
System. |
true if the |
CreateWritableClone()
Declaration
public virtual CategoryCollection CreateWritableClone()
Returns
Type | Description |
---|---|
Category |
GetEnumerator()
Returns an enumerator that iterates through all the categories in the collection.
Declaration
public IEnumerator<Category> GetEnumerator()
Returns
Type | Description |
---|---|
System. |
An enumerator that can be used to iterate through the collection. |
IndexOf(Category)
Determines the index of a specific category in the Category
Declaration
public virtual int IndexOf(Category item)
Parameters
Type | Name | Description |
---|---|---|
Category | item | The category to locate in the Category |
Returns
Type | Description |
---|---|
System. |
The index of the |
Insert(Int32, Category)
Inserts an item to the Category
Declaration
public virtual void Insert(int index, Category item)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | The zero-based index at which |
Category | item | The object to insert into the Category |
MakeReadOnly()
Declaration
public virtual void MakeReadOnly()
Remove(Category)
Removes the first occurrence of a specific category from the Category
Declaration
public virtual bool Remove(Category item)
Parameters
Type | Name | Description |
---|---|---|
Category | item | The category to remove from the Category |
Returns
Type | Description |
---|---|
System. |
true if |
RemoveAt(Int32)
Removes the category at the specified index in the Category
Declaration
public virtual void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | The zero-based index of the category to remove. |
ThrowIfReadOnly()
Throws an exception if the Category
Declaration
protected void ThrowIfReadOnly()
Explicit Interface Implementations
IReadOnly.CreateWritableClone()
Declaration
object IReadOnly.CreateWritableClone()
Returns
Type | Description |
---|---|
System. |