MoaidHathot / Dumpify

Adding `.Dump()` extension methods to Console Applications, similar to LinqPad's.
MIT License
959 stars 40 forks source link

Add caller expression argument attribute to auto label dumps #16

Closed SaahilClaypool closed 1 year ago

SaahilClaypool commented 1 year ago

Hi - great library! I've been using this and I thought it'd be useful to use the caller argument expression attribute to set the label to the variable name that is being dumped when not otherwise provided.

Just thought it'd be useful

MoaidHathot commented 1 year ago

Thanks! this means we'll always have a Label to our objects. I'll merge this PR and play with it a bit. Maybe I'll add a configuration to turn it o or off later.

MoaidHathot commented 1 year ago

Thanks @SaahilClaypool

MoaidHathot commented 9 months ago

Hi @SaahilClaypool , this change is part of the new release, but notice that I made a few changes. This feature won't be on by default, at least until we hear some feedback from the community. You can turn this feature on or off via per-dump or globaly (for all dumps) config

    new { Description = "You can manually specify labels to objects" }.Dump("Manual label");

    //Set auto-label globally for all dumps if a custom label wasn't provider
    DumpConfig.Default.UseAutoLabels = true;
    new { Description = "Or set labels automatically with auto-labels" }.Dump();

image