# ImageList.ImageCollection

Namespace: **Wisej.Web**

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

Encapsulates the collection of [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) objects in an [ImageList](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist).

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

```csharp
public class ImageCollection : IList, ICollection, IEnumerable
```

{% endtab %}

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

```visual-basic
Public Class ImageCollection
    Inherits IList
    Implements ICollection, IEnumerable
```

{% endtab %}
{% endtabs %}

## Properties

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Count

[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32): Returns the number of [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) in the collection.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Item(index)

[ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection): Returns the image at the index.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Item(key)

[ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection): Returns the first image identified by the key.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Keys

[List\<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list): Returns a collection with all the image keys.

## Methods

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Add(key, image)

Adds the image to the collection.

| Parameter | Type                                                                      | Description                                                                                      |
| --------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **key**   | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)       | The key associated with the *image* .                                                            |
| **image** | [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) | An [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) to add to the list. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Add(key, imageSource)

Adds the image source to the collection.

| Parameter       | Type                                                                | Description                                      |
| --------------- | ------------------------------------------------------------------- | ------------------------------------------------ |
| **key**         | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The key associated with the *imageSource* .      |
| **imageSource** | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The name or URL of the image to add to the list. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Add(image)

Adds the specified *image* to the collection.

| Parameter | Type                                                                      | Description                                                                                      |
| --------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **image** | [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) | An [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) to add to the list. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Add(imageSource)

Adds the specified *imageSource* to the collection.

| Parameter       | Type                                                                | Description                                      |
| --------------- | ------------------------------------------------------------------- | ------------------------------------------------ |
| **imageSource** | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The name or URl of the image to add to the list. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Add(entry)

Adds the image entry to the collection.

| Parameter | Type                                                                                                              | Description                                                                                                                                     |
| --------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **entry** | [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) | The [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) to add to the collection. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)AddRange(entries)

Adds an array of [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) to the collection.

| Parameter   | Type                                                                                                                  | Description                                                                                                                           |
| ----------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| **entries** | [ImageListEntry\[\]](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) | An array of [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) objects |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *entries* is null.
* [ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentexception) *entries* is the child of another [TreeView](https://docs.wisej.com/api/v2.5/wisej.web/lists-and-grids/treeview).

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Clear()

Removes all images from the collection.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Contains(image)

Finds if the collection contains the *image* .

| Parameter | Type                                                                      | Description                                                                                                |
| --------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **image** | [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) | The [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). True if the collection contains the specified *image* .

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)ContainsKey(key)

Finds if the collection contains the image *key* .

| Parameter | Type                                                                | Description                          |
| --------- | ------------------------------------------------------------------- | ------------------------------------ |
| **key**   | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The key to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). True if the collection contains the specified *key* .

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)GetEnumerator()

Returns an enumerator that iterates the images in the collection.

**Returns:** [IEnumerator](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerator).

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)IndexOf(image)

Returns the index of the *image* in the collection.

| Parameter | Type                                                                      | Description                                                                                                 |
| --------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **image** | [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) | The [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) to located in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32). The index of the specified *image* in the collection; otherwise -1 if not found.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)IndexOfKey(key)

Returns the index of the image *key* in the collection.

| Parameter | Type                                                                | Description                           |
| --------- | ------------------------------------------------------------------- | ------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The key to located in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32). The index of the specified *key* in the collection; otherwise -1 if not found.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Insert(index, entry)

Inserts the [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) at the specified index.

| Parameter | Type                                                                                                              | Description                                                                                                                                                               |
| --------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)                                                 | The position in the collection where to add the *entry* .                                                                                                                 |
| **entry** | [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) | The [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) to add to the collection at the specified *index* . |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Remove(image)

Removes the *image* from the collection.

| Parameter | Type                                                                      | Description                                                                                                  |
| --------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **image** | [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) | The [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) to remove from the collection. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)RemoveAt(index)

Removes the image at the specified *index* from the collection.

| Parameter | Type                                                              | Description                                                                                                                                                       |
| --------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The index of the [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) to remove from the collection. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)RemoveByKey(key)

Removes the images identified by the *key* from the collection.

| Parameter | Type                                                                | Description                                                                                                                                                     |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The key of the [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) to remove from the collection. |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)SetKeyName(index, name)

Sets the key (name) associated with the image.

| Parameter | Type                                                                | Description                                                                                                                                                      |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)   | The index of the [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) to change.                    |
| **name**  | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The new name of the [ImageListEntry](https://docs.wisej.com/api/v2.5/wisej.web/content/imagelist/wisej.web.imagelist.imagecollection) at the specified *index* . |
