DumpOptions attribute to customize Dump()
1) Ignore - ignore field/property/class in the dumped tree
Example:
public class AggregatedError
{
public string Name { get; private set; }
[DumpOptions(Options.Ignore)]
public string[] Files { get; private set; }
}
will not display Files property.
2) NotExpanded - do not expand collection by default
Example:
public class AggregatedError
{
public string Name { get; private set; }
[DumpOptions(Options.NotExpanded)]
public string[] Files { get; private set; }
}
will display Files as a collection, but will not expand its by default
3) ToString - display object as string
Example:
[DumpOptions(Options.ToString)]
public class AggregatedError
{
public override string ToString()
{
return "my string representation";
}
}
will display only string representation of AggregatedError objects
-
Andrew Allen commented
It would be also useful to be able to specify the classes/fields/properties to ignore with a "Settings" object that wouldn't require modification of the classes themselves. My use case is dumping out some very elaborate 3rd-party data structures, many fields of which of are unimportant and need to be hidden so you can see the "important parts".