ListBindingHelper.GetListItemType Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the type of an item contained in a list or collection.
Overloads
GetListItemType(Object) |
Returns the data type of the items in the specified list. |
GetListItemType(Object, String) |
Returns the data type of the items in the specified data source. |
GetListItemType(Object)
Returns the data type of the items in the specified list.
public:
static Type ^ GetListItemType(System::Object ^ list);
public static Type GetListItemType (object list);
public static Type? GetListItemType (object? list);
static member GetListItemType : obj -> Type
Public Shared Function GetListItemType (list As Object) As Type
Parameters
- list
- Object
The list to be examined for type information.
Returns
The Type of the items contained in the list.
Remarks
If the list
parameter is not a list or array, the type returned will be that of the list
parameter itself.
Applies to
GetListItemType(Object, String)
Returns the data type of the items in the specified data source.
public:
static Type ^ GetListItemType(System::Object ^ dataSource, System::String ^ dataMember);
public static Type GetListItemType (object dataSource, string dataMember);
public static Type? GetListItemType (object? dataSource, string? dataMember);
public static Type GetListItemType (object? dataSource, string? dataMember);
static member GetListItemType : obj * string -> Type
Public Shared Function GetListItemType (dataSource As Object, dataMember As String) As Type
Parameters
- dataSource
- Object
The data source to examine for items.
- dataMember
- 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
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.
Remarks
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.