I have the following problem: I select data from a DB, and for each item from the table, I create a model. That model contains a list, wich contains the name in 3 languages. But for some reason, LINQ does not keep my list initialization order.
Code:
db.SA_BamaType
.Select(b => new BamaTypeModel()
{
id = b.p_bamatype,
bamatypeNames = new List<string>()
{b.bamatypeafdrukNL, b.bamatypeafdrukFR, b.bamatypeafdrukEN}
}).ToList();
But when I debug this list, I see that the items are random switched from position. EN would become index 0, while NL should be index 0.
A dictionary would be the best use for this, but it seems LINQ can't translate a dictionary, that's why I used a List.