vendredi 10 juillet 2020

How to tell if an object has the default value for its type? [duplicate]

I am examining an object via reflection, and I want to print those properties which have non-default values. Given a signature like this:

public static bool IsDefaultValue(PropertyInfo prop, object o)
{
 //returns true if the given property's value on o is the default value for the property type
}

How could this be implemented?





Aucun commentaire:

Enregistrer un commentaire