logging all properties of an object in c#. how to log inner object properties as well?
问题 i am trying to (1) log all properties of an object, and (2) all properties of a specific object type within. i can do the (1) but not (2). this is the case now. foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(object1)) { string name = descriptor.Name; object value = descriptor.GetValue(object1); logger.Debug(String.Format("{0} = {1}", name, value)); } what i need is something like: foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(object1)) { string