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
![](https://secure.gravatar.com/avatar/abdb0b52790d985f83781570b76bd31a?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
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".