I try fill property type of ICollection<Person>
or ICollection<T>
.I give an objectList type of List<object>
or ICollection<object>
anyway i can't set value property type of ICollection<Person>
by list of object
if (property.PropertyType.IsGenericType &&
property.PropertyType.GetGenericTypeDefinition()
== typeof(ICollection<>))
{
Type itemType = property.PropertyType.GetGenericArguments()[0];
ICollection<object> objectList =GetObjectList();
property.SetValue(item, objectList);
}
thanks.