Expression string dump bug?

Comments

  • clem0338
    edited May 7

    I confirm I can reproduce but only when using VB language

  • rorourke
    edited May 7

    For Expression, this is the behavior I'd expect. C# Expression behaves the same. The statement "5".Dump() outputs to the Results pane because that's the nature of Dump(). Dump() returns the "5" which is the actual expression that also outputs to the Results pane (because that's the nature of the Expression language variants).

  • That's right - Dump() is a fluent method that returns the input.

    This lets you to inject Dump() into the middle of statements:

    new[] { 11, 5, 17, 7, 13 }  .Dump ("Prime numbers")
       .Where (n => n > 10)     .Dump ("Prime numbers > 10")
       .OrderBy (n => n)        .Dump ("Prime numbers > 10 sorted")
       .Select (n => n * 10)    .Dump ("Prime numbers > 10 sorted, times 10!");
    

    and allows this:

    DateTime now = DateTime.Now.Dump();