Home

how can i exclude some of the attributes at depth 2?

i have a list that i want to hide 3 columns in the output. How can i update the Util.HorizontalRun(true, TradeObjectsFiltered).Dump(exclude: ?????" to factor the elements at depth 2 and only ignore some of the columns.

Comments

  • edited April 2023

    Write a ToDump method in the query:

    static object ToDump (object input)
    {
        if (input is Event e)
            return new { e.Prop1, e.Prop2, ... };  // Properties that you want
    
        return input;
    }
    

    Alternatively:

    static object ToDump (object input)
    {
        if (input is Event e)
            return Util.ToExpando (e, include:"...");
    
        return input;
    }
    

    or:

    static object ToDump (object input)
    {
        if (input is Event e)
            return Util.ToExpando (e, exclude:"...");
    
        return input;
    }
    

    You can also programmatically add or remove properties from the expando, should that be easier.

    Make sure the query type is set to "C# Program", otherwise the ToDump method will not work.

Sign In or Register to comment.