vendredi 2 mars 2018

Pivot List with dynamic elements in c#

I have a list of :

    class Decoderobj
    {
        public dynamic decompiled { get; set; }
        public int? tableid { get; set; }
        public int? columnid { get; set; }

    }

 List<Decoderobj> list = new List<Decoderobj>();

I have to pivot this list by linq grouping by tableid considering columnid is dynamic , i can have n column: Example :

Input

decompiled 1 tableid 1 columnid 1

decpmpiled 9 tableid 1 columnid 2

decpmpiled 6 tableid 1 columnid 3

decpmpiled 4 tableid 1 columnid 50

decpmpiled 2 tableid 2 columnid 50

Output should be

Table 1

1 | 2 | 3 | 50 | (This are Column name Joining another table that i have column name)

1 | 9 | 6 | 3 |

Table 2


| 50 | (This are Column name Joining another table that i have column name)

| 2 |





Aucun commentaire:

Enregistrer un commentaire