private Type detectCollectionType()
{
PropertyInfo[] properties = TypeDescriptor.GetReflectionType(this.CollectionType)
.GetProperties(BindingFlags.Instance | BindingFlags.Public);
for (int i = 0; i < properties.Length; i++)
{
if (properties[i].Name == "Item" || properties[i].Name == "Items")
return properties[i].PropertyType;
}
return typeof(object);
}