I am iterating an object using reflection like so:
foreach (PropertyInfo property in properties)
{
object prop = property.GetValue(myObjectInstance);
// TODO: I need to check if prop carries a default value for its respective type
}
How I can check if the prop is equal to the type's default value (for instance, if the property is of DateTime, then check for default(DateTime))?
Aucun commentaire:
Enregistrer un commentaire