Export (0) Print
Expand All

ListBindingHelper.GetListItemType Method (Object, String)

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

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

public static Type GetListItemType(
	Object dataSource,
	string dataMember


Type: System.Object

The data source to examine for items.

Type: 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.

Return Value

Type: System.Type
For complex data binding, the Type of the items represented by the dataMember in the data source; otherwise, the Type of the item in the list itself.

This version of the GetListItemType method is used to determine the type of items used in complex or simple data-binding schemes. This static method may be useful in determining whether a proposed data-binding scheme is appropriate before attempting it.

If dataSource is null, the property descriptors cannot be found for the list items of the specified data member, or the property descriptor for the list item is an ICustomTypeDescriptor, then this method returns the type of the Object class.

If dataMember is null or empty, then this method returns the Type of the items in the data source, if it is a list; otherwise, this method returns the Type of the data source itself.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft