# ListBindingHelper

Namespace: **Wisej.Web**

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

Provides functionality to discover a bindable list and the properties of the items contained in the list when they differ from the public properties of the object to which they bind.

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

```csharp
public class ListBindingHelper
```

{% endtab %}

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

```visual-basic
Public Class ListBindingHelper
```

{% endtab %}
{% endtabs %}

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetList(list)

Returns a list associated with the specified data source.

| Parameter | Type                                                          | Description                                         |
| --------- | ------------------------------------------------------------- | --------------------------------------------------- |
| **list**  | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data source to examine for its underlying list. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An [Object](https://docs.microsoft.com/dotnet/api/system.object) representing the underlying list if it exists; otherwise, the original data source specified by *list* .

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetList(dataSource, dataMember)

Returns an object, typically a list, from the evaluation of a specified data source and optional data member.

| Parameter      | Type                                                          | Description                                                                    |
| -------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| **dataSource** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data source from which to find the list.                                   |
| **dataMember** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the data source property that contains the list. This can be null. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An [Object](https://docs.microsoft.com/dotnet/api/system.object) representing the underlying list if it was found; otherwise, *dataSource* .

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The specified data member name did not match any of the properties found for the data source.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetListItemProperties(list)

Returns the [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection) that describes the properties of an item type contained in a specified data source, or properties of the specified data source.

| Parameter | Type                                                          | Description                                          |
| --------- | ------------------------------------------------------------- | ---------------------------------------------------- |
| **list**  | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data source to examine for property information. |

**Returns:** [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection). The [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection) containing the properties of the items contained in *list* , or properties of *list..*

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetListItemProperties(list, listAccessors)

Returns the [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection) that describes the properties of an item type contained in a collection property of a data source. Uses the specified [PropertyDescriptor](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) array to indicate which properties to examine.

| Parameter         | Type                                                                                                     | Description                                                                                                                                                                                 |
| ----------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **list**          | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                            | The data source to be examined for property information.                                                                                                                                    |
| **listAccessors** | [PropertyDescriptor\[\]](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) | The [PropertyDescriptor](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) array describing which properties of the data source to examine. This can be null. |

**Returns:** [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection). The [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection) describing the properties of the item type contained in a collection property of the data source.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetListItemProperties(dataSource, dataMember, listAccessors)

Returns the [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection) that describes the properties of an item type contained in the specified data member of a data source. Uses the specified [PropertyDescriptor](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) array to indicate which properties to examine.

| Parameter         | Type                                                                                                     | Description                                                                                                                                                                                 |
| ----------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **dataSource**    | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                            | The data source to be examined for property information.                                                                                                                                    |
| **dataMember**    | [String](https://docs.microsoft.com/dotnet/api/system.string)                                            | The optional data member to be examined for property information. This can be null.                                                                                                         |
| **listAccessors** | [PropertyDescriptor\[\]](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) | The [PropertyDescriptor](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) array describing which properties of the data member to examine. This can be null. |

**Returns:** [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection). The [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection) describing the properties of an item type contained in a collection property of the specified data source.

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The specified data member could not be found in the specified data source.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetListItemType(list)

Returns the data type of the items in the specified list.

| Parameter | Type                                                          | Description                                   |
| --------- | ------------------------------------------------------------- | --------------------------------------------- |
| **list**  | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The list to be examined for type information. |

**Returns:** [Type](https://docs.microsoft.com/dotnet/api/system.type). The [Type](https://docs.microsoft.com/dotnet/api/system.type) of the items contained in the list.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetListItemType(dataSource, dataMember)

Returns the data type of the items in the specified data source.

| Parameter      | Type                                                          | Description                                                                                                   |
| -------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **dataSource** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data source to examine for items.                                                                         |
| **dataMember** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The optional name of the property on the data source that is to be used as the data member. This can be null. |

**Returns:** [Type](https://docs.microsoft.com/dotnet/api/system.type). For complex data binding, the [Type](https://docs.microsoft.com/dotnet/api/system.type) of the items represented by the *dataMember* in the data source; otherwise, the [Type](https://docs.microsoft.com/dotnet/api/system.type) of the item in the list itself.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetListName(list, listAccessors)

Returns the name of an underlying list, given a data source and optional [PropertyDescriptor](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) array.

| Parameter         | Type                                                                                                     | Description                                                                                                                                                            |
| ----------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **list**          | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                            | The data source to examine for the list name.                                                                                                                          |
| **listAccessors** | [PropertyDescriptor\[\]](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) | An array of [PropertyDescriptor](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptor) objects to find in the data source. This can be null. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The name of the list in the data source, as described by *listAccessors* , or the name of the data source type.
