, , - ...
. , BindingSource.DataSource IEnumerable, . , BindingSource , "itemType". , : , BindingSource , BindingSource, .
, :
FieldInfo fi =
typeof(BindingSource)
.GetField("itemType", BindingFlags.NonPublic | BindingFlags.Instance);
Type myElementType = fi.GetValue(DataBinder.RestrictedDataBinding) as Type;
, , innerList, , DataSource . , , , BindingSource ( IQueryables ..).
: , , , . , , DataSource BindingSource reset? , DataSource reset elementType? , .
Finally, using reflection to break into private fields breaks down all sorts of oop principles. Remember. Also, keep in mind that very well may be a good reason why the itemType field was hidden. If you need to further explore, the code for the BindingSource class is publicly available.
source
share