public class AdditionValue
{
private readonly int _a;
private readonly int _b;
public AdditionValue(int a, int b)
{
_a = a;
_b = b;
}
private int Value => _a _b;
}
new AdditionValue(1, 2).Dump(members: new MembersConfig { IncludeFields = true, IncludeNonPublicMembers = true });
您可以自定义颜色
代码语言:javascript复制
var package = new { Name = "Dumpify", Description = "Dump any object to Console" };
package.Dump(colors: ColorConfig.NoColors);
package.Dump(colors: new ColorConfig { PropertyValueColor = new DumpColor(Color.RoyalBlue)});
您可以打开或关闭类型名称,标题,标签等
代码语言:javascript复制
var moaid = new Person { FirstName = "Moaid", LastName = "Hathot", Profession = Profession.Software };
var haneeni = new Person { FirstName = "Haneeni", LastName = "Shibli", Profession = Profession.Health };
moaid.Spouse = haneeni;
haneeni.Spouse = moaid;
moaid.Dump(typeNames: new TypeNamingConfig { ShowTypeNames = false }, tableConfig: new TableConfig { ShowTableHeaders = false });
有多个输出选项(控制台、跟踪、调试、文本)或提供您自己的输出选项
代码语言:javascript复制
var package = new { Name = "Dumpify", Description = "Dump any object to Console" };
package.Dump(); //Similar to `package.DumpConsole()` and `package.Dump(output: Outputs.Console))`
package.DumpDebug(); //Dump to Visual Studio's Debug source
package.DumpTrace(); //Dump to Trace
var text = package.DumpText(); //The table in a text format
using var writer = new StringWriter();
package.Dump(output: new DumpOutput(writer)); //Custom output