Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7190731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:34:42+00:00 2026-05-28T19:34:42+00:00

I have the following problem: I select data from a DB, and for each

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:34:43+00:00Added an answer on May 28, 2026 at 7:34 pm

    but it seems LINQ can’t translate a dictionary

    Of course it can:

    db.SA_BamaType
                .AsEnumerable()
                .Select(b => new BamaTypeModel()
                {
                    id = b.p_bamatype,
                    bamatypeNames = new Dictionary<string, string>
                    {
                        { "NL", b.bamatypeafdrukNL },
                        { "FR", b.bamatypeafdrukFR },
                        { "EN", b.bamatypeafdrukEN }
                    }
                }).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put together the following code, the problem is that each while loop
I have the following table: OrderHasItem OrderTable_idOrder Item_idItem quantity SELECT Item_idItem, COUNT(Item_idItem)+quantity FROM OrderHasItem
So im having a problem (obviously). I have the following MySQL table data 7
I have the following problem in my Data Structures and Problem Solving using Java
I have the following table: CREATE TABLE [dbo].[Tree]( [AutoID] [int] IDENTITY(1,1) NOT NULL, [Category]
I have the following example code: create table Details( name varchar(20), age int, weight
I have the following problem: I have 3 tables: If you want to create
I have an application that deals with data in the following structure: struct Message
So I have a problem with the following code. I have an array that
I need to create a process that will extract the changes from a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.