Auto-Create a DumpContainer in Dump(string containerName)
DumpContainer is cool, but it's not convenient to new a DumpContainer() and set the Content.
Please support Dump(string containerName).
Like this:
public static class DumpExtensions
{
public static Dictionary<string, DumpContainer> dict = new Dictionary<string, LINQPad.DumpContainer> { };
public static T Dump<T>(this T obj, string description, string containerName)
{
if (!dict.ContainsKey(containerName))
{
dict[containerName] = new DumpContainer().Dump();
}
dict[containerName].Content = obj;
return obj;
}
}
// Then I can simplely print 1-100 in 5 containers
void Main()
{
DumpExtensions.dict.Clear();
for (int i = 0; i < 100; i++)
{
i.Dump("", (i%5).ToString());
System.Threading.Thread.Sleep(100);
}
}
5
votes
aqi
shared this idea