using System.Reflection; namespace MigraDoc.Rendering.UnitTest { /// /// Summary description for ValueDumper. /// public class ValueDumper { public ValueDumper() { } public static string DumpValues(object obj) { string dumpString = "[" + obj.GetType() + "]\r\n"; foreach (FieldInfo fieldInfo in obj.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) { if (fieldInfo.FieldType.IsValueType) { dumpString += " " + fieldInfo.Name + " = " + fieldInfo.GetValue(obj) + "\r\n"; } } return dumpString; } } }