Option to dump with a lambda to dump a specific property?

I use a fluent object for doing stuff with executing processes.

ProcessExtensions.New( "SmartCopy", "GetLib", rootFolder.FullName ).HideWindow().RunAndGetOutput().Dump().ExitCode.ThrowOnNonZero();

The object I'm dumping has way too much stuff on it, I think I could probably use the "Depth = 1" override and that would be pretty good.

But I thought it might be interesting to do a dump with a lambda, especially since I really only want to dump the processes output.

.Dump( x => x.Output )


This way I could dump the property I want to show, and it would still fluently return the full object that I was on.

Comments

  • Have you thought about adding that method to add to "My Extensions"?
    public static T Dump<T, U> (this T input, Func<T, U> toDump)
    {
        toDump (input).Dump();
        return input;
    }
  • Works like a charm, thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!