ListBindingHelper.GetList Method (Object, String)

 

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

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public static object GetList(
	object dataSource,
	string dataMember
)

Parameters

dataSource
Type: System.Object

The data source from which to find the list.

dataMember
Type: System.String

The name of the data source property that contains the list. This can be null.

Return Value

Type: System.Object

An Object representing the underlying list if it was found; otherwise, dataSource.

Exception Condition
ArgumentException

The specified data member name did not match any of the properties found for the data source.

If the data member is null or an empty string (""), the GetList method returns dataSource.

If dataSource is not a list, GetList returns the value of the dataSource property that matches the dataMember value.

If dataSource is a list, in that it implements either the ICurrencyManagerProvider or IEnumerable interfaces, then the underlying list is obtained by choosing an item from the list and querying that item for the value of the property named by dataMember.

.NET Framework
Available since 2.0
Return to top
Show: