lundi 11 février 2019

Convert anonymous type to List

I have a set of anonymous object dumped from a database which contains many fields (up to 50).

Example :

var anonymousData = new
        {
            Z = "2",
            B = "4",
            C = "3",
            D = 5
        }; 

I'd like to have the following output with such data

List<object> allObjects ... with { "2", "4", "3", 5 };

What is the correct way to reflect it ?

EDIT : I'd like to keep the initial order





Aucun commentaire:

Enregistrer un commentaire