Export (0) Print
Expand All

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


Type: System.Object
The data source from which to find the list.
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.


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

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft