ASCU_ALL/PrintPDF/MigraDoc.Rendering/Rendering.UnitTest/ValueDumper.cs
2021-05-25 17:00:45 +05:00

27 lines
733 B
C#

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;
}
}
}