private String[] GetProperties(EContent_EcontentFields eContentField)
{
List<String> list = new List<String>();
Type fieldType = eContentField.GetType();
var properties = fieldType.GetProperties();
foreach (var prop in properties)
{
if (prop.MemberType == MemberTypes.Property)
{
if (prop.PropertyType.IsGenericType)
{
dynamic items = prop.GetValue(eContentField, null);
foreach (var item in items)
{
Type typeItem = item.GetType();
list.Add(item);
}
}
}
}
return list.ToArray();
}
This is my method to retrieve an array of strings with the properties of my entity but the statement:
if (prop.PropertyType.IsGenericType)
It's always false. I've copy-pasted the code so maybe I'm missing something. Something that I can't see.
Aucun commentaire:
Enregistrer un commentaire