Hello I need to check using reflection whether property is IEnumerable
type but no IEnumerable of string, int, double, etc.
Right now I have that part of code:
private bool IsEnumerable(PropertyInfo propertyInfo)
{
return propertyInfo.PropertyType.GetInterfaces().Contains(typeof(IEnumerable)) &&
propertyInfo.PropertyType != typeof(string);
}
If property is IEnumerable<MyCustomType>
this is ok, but if it is IEnumerable<string>
my method should return false.
Aucun commentaire:
Enregistrer un commentaire