# Accordion.PanelCollection

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

Contains a collection of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) objects.

{% tabs %}
{% tab title="C#" %}

```csharp
public class PanelCollection : IList, ICollection, IEnumerable, IList<AccordionPanel>, ICollection<AccordionPanel>, IEnumerable<AccordionPanel>
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class PanelCollection
    Inherits IList
    Implements ICollection, IEnumerable, IList(Of AccordionPanel), ICollection(Of AccordionPanel), IEnumerable(Of AccordionPanel)
```

{% endtab %}
{% endtabs %}

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) Count

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the number of panels in the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(index)

[AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md): Returns or sets a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) in the collection at the specified index.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) *index* is less than zero or greater than the highest available index.
* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) *value* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(name)

[AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md): Returns the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key from the collection.

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(panel)

Adds a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to the collection.

| Parameter | Type                                                                              | Description                                                                                   |
| --------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| **panel** | [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to add. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) The specified *panel* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(text)

Creates a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified text, and adds it to the collection.

| Parameter | Type                                                          | Description                       |
| --------- | ------------------------------------------------------------- | --------------------------------- |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the panel. |

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text)

Creates a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key and text and adds it to the collection.

| Parameter | Type                                                          | Description                                                                                                            |
| --------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                     |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the title of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text, imageIndex)

Creates a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key, text, and image, and adds it to the collection.

| Parameter      | Type                                                          | Description                                                                                                                              |
| -------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **key**        | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                                       |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                            |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The index of the image to display on the title of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text, imageKey)

Creates a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key, text, and image, and adds it to the collection.

| Parameter    | Type                                                          | Description                                                                                                                            |
| ------------ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **key**      | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                                     |
| **text**     | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                          |
| **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The key of the image to display on the title of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) AddRange(panels)

Adds a set of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panels to the collection.

| Parameter  | Type                                                                                  | Description                                                                                                                         |
| ---------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| **panels** | [AccordionPanel\[\]](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | An array of type [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) that contains the panels to add. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) The value of panels is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) Clear()

Removes all the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panels from the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Clear(dispose)

Removes and disposes all [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panels from the collection.

| Parameter   | Type                                                            | Description                                                                                                                                            |
| ----------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **dispose** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates whether to dispose the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panels removed from the collection. |

### ![](/files/hsR4ok3152WyAf8J2C1u) Contains(panel)

Determines whether a specified [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) is in the collection.

| Parameter | Type                                                                              | Description                                                                                                        |
| --------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **panel** | [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the specified [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) is in the collection; otherwise, false.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) The value of *panel* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) ContainsKey(key)

Determines whether the collection contains a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key.

| Parameter | Type                                                          | Description                                                                                                      |
| --------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to search for. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true to indicate a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key was found in the collection; otherwise, false.

### ![](/files/hsR4ok3152WyAf8J2C1u) CopyTo(array, index)

Copies the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panels in the collection to the specified array, starting at the specified index.

| Parameter | Type                                                                                  | Description                                                                                                                                                                                                            |
| --------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **array** | [AccordionPanel\[\]](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The one-dimensional array that is the destination of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panels copied from the collection. The array must have zero-based indexing. |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                           | The zero-based index in the array at which copying begins.                                                                                                                                                             |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) *array* is null.
* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) *array* is less than zero.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) *array* is multidimensional or the number of elements in the [Panels](/api/wisej.web/containers/accordion.md#panels) is greater than the available space from index to the end of *array* .

### ![](/files/hsR4ok3152WyAf8J2C1u) IndexOf(panel)

Returns the index of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) in the collection.

| Parameter | Type                                                                              | Description                                                                                                        |
| --------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **panel** | [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to locate in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the panel; -1 if it cannot be found.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) The value of *panel* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) IndexOfKey(key)

Returns the index of the first occurrence of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key.

| Parameter | Type                                                          | Description                                                                                                                  |
| --------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to find in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the first occurrence of a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key, if found; otherwise, -1.

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, panel)

Inserts an existing [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) into the collection at the specified index.

| Parameter | Type                                                                              | Description                                                                                                                            |
| --------- | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                       | The zero-based index location where the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) is inserted. |
| **panel** | [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to insert in the collection.                     |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, text)

Creates a new [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified text and inserts it into the collection at the specified index.

| Parameter | Type                                                          | Description                                                                                                                            |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) is inserted. |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                          |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text)

Creates a new [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key and text, and inserts it into the collection at the specified index.

| Parameter | Type                                                          | Description                                                                                                                            |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) is inserted. |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                                     |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                          |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text, imageIndex)

Creates a new [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key, text, and image, and inserts it into the collection at the specified index.

| Parameter      | Type                                                          | Description                                                                                                                            |
| -------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **index**      | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) is inserted  |
| **key**        | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                                     |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                          |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index of the image to display on the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text, imageKey)

Creates a [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key, text, and image, and inserts it into the collection at the specified index.

| Parameter    | Type                                                          | Description                                                                                                                            |
| ------------ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **index**    | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) is inserted. |
| **key**      | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                                     |
| **text**     | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).                          |
| **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The key of the image to display on the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).              |

### ![](/files/hsR4ok3152WyAf8J2C1u) Remove(panel)

Removes the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) from the collection.

| Parameter | Type                                                                              | Description                                                                                      |
| --------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **panel** | [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to remove. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) The *panel* parameter is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) RemoveAt(index)

Removes the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) at the specified index from the collection.

| Parameter | Type                                                        | Description                                                                                                              |
| --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The zero-based index of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to remove. |

### ![](/files/hsR4ok3152WyAf8J2C1u) RemoveByKey(key)

Removes the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified key from the collection.

| Parameter | Type                                                          | Description                                                                                                  |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to remove. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/containers/accordion/wisej.web.accordion.panelcollection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
