ASCU_ALL/PrintPDF/MigraDoc.Rendering/Rendering.UnitTest/ValueDumper.cs

27 lines
733 B
C#
Raw Normal View History

2020-09-04 12:49:15 +05:00
using System.Reflection;
namespace MigraDoc.Rendering.UnitTest
{
/// <summary>
/// Summary description for ValueDumper.
/// </summary>
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;
}
}
}