void Main()
{
var f = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat;
f.FirstDayOfWeek.Dump("");
f.NativeCalendarName.DumpIndented(1);
f.FullDateTimePattern.DumpTellIndented(1);
f.LongDatePattern.DumpTellIndented(2);
f.Calendar.DumpIndented(3, "Calendar", collapseTo:1);
f.AbbreviatedDayNames.DumpTellIndented(2,collapseTo: 0);
}
public static class Indent
{
public static int SizeOfIndent = 10;
public static T DumpIndented<T>(this T obj, int indentLevel = 0, string? description = null, int? collapseTo = null)
{
string indent = " ".PadLeft(indentLevel * SizeOfIndent);
if (description != null)
Util.HorizontalRun(true, indent, Util.WithHeading(obj, description)).Dump(collapseTo: collapseTo);
else
Util.HorizontalRun(true, indent, obj).Dump(collapseTo: collapseTo );
return obj;
}
public static T DumpTellIndented<T>(this T obj, int indentLevel = 0, [System.Runtime.CompilerServices.CallerArgumentExpression("obj")] string? autoGeneratedDescription = null, int? collapseTo = null)
{
string indent = " ".PadLeft(indentLevel * SizeOfIndent);
Util.HorizontalRun(true, indent, Util.WithHeading(obj, autoGeneratedDescription)).Dump(collapseTo: collapseTo);
return obj;
}
}
Results look like
Of course there are a whole load of more optional parameters available with dump and I have just using two, but it is probably easy to add most of the rest of them.
Comments
Would something like this work?
Results look like

Of course there are a whole load of more optional parameters available with dump and I have just using two, but it is probably easy to add most of the rest of them.
Yes, something like that. I hope that feature can be built-in to LINQPad.
Usage example:
Or like this: