I'm using reflection to identify object properties , Now i need to identify object property is user defined or not. i have try as following way
foreach (System.Reflection.PropertyInfo prop in typeof(Domain.Entities.UrlClass).GetProperties().Where(p => p.CanWrite))
{
if (prop.Name.ToLower() == column.ToLower() && prop.ReflectedType.IsPrimitive)
{
prop.SetValue(entityToMap, Convert.ChangeType(cellValue, prop.PropertyType));
break;
}
}
But this prop.ReflectedType.IsPrimitive
is always false for string property is anyone have idea to separate user defined types and primitive types?
thanks.
Aucun commentaire:
Enregistrer un commentaire