public int TheInt { get; set; }
public string TheString { get; set; }
public DateTimeOffset TheStruct { get; set; }
public AnEnum TheEnum { get; set; }
public Bar TheCustomObject { get; set; }
public static void Main()
foreach (PropertyInfo property in foo.GetType().GetProperties())
object def = property.PropertyType.IsValueType ? Activator.CreateInstance(property.PropertyType) : null;
object val = property.GetValue(foo);
if (object.Equals(val, def))
Console.WriteLine("foo." + property.Name + " value is the default value (" + val + ')');
Console.WriteLine("foo." + property.Name + " value is not the default value (" + val + ')');