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 7030087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:37:26+00:00 2026-05-28T00:37:26+00:00

How to Put the following query result into a List var result = from

  • 0

How to Put the following query result into a List

var  result = from c in sb.Swithches_SW_PanalComponents
                     select new { c.ID,c.SW_PanalComponents.ComponentsName,c.ComponentValue };
  • 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-28T00:37:27+00:00Added an answer on May 28, 2026 at 12:37 am

    FINAL EDIT

    Based on your last comment, this is all you ever needed

    List<Swithches_SW_PanalComponents> result = 
                                      sb.Swithches_SW_PanalComponents.ToList();
    

    which of course is identical to

    var result = sb.Swithches_SW_PanalComponents.ToList();
    

    EDIT

    Based on your comments, I think this is what you want:

    List<SW_PanalComponents> result = sb.Swithches_SW_PanalComponents
                      .Select(c => new SW_PanalComponents { /* initialize your fields */ })
                      .ToList();
    

    END EDIT

    The ToList method is what you want. But consider using dot notation. For simple queries like this, it’s much cleaner and trimmer.

    var result = sb.Swithches_SW_PanalComponents
                      .Select(c => new { c.ID, c.SW_PanalComponents.ComponentsName, c.ComponentValue })
                      .ToList();
    

    Also note that, if you’re just trying to execute your query immediately, and only need to enumerate over it, you can also call AsEnumerable()

    var result = sb.Swithches_SW_PanalComponents
                      .Select(c => new { c.ID, c.SW_PanalComponents.ComponentsName, c.ComponentValue })
                      .AsEnumerable();
    

    The advantage here is that result is a less specific type—IEnumerablt<T>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following query to return a single value: select er.elig_code from
I have the following query: select p.ID, Received = (select Rec from Exp where
I wanna put the results from sql query into a table but if i
I am trying to put the following code into VBA. What I ideally want
The following jQuery example should put some text into the div, but it doesn't.
I used xpath checker to build the following xpath query: /eveapi/result/rowset/row[1]/@solarSystemName on the following
I have the following query called searchit SELECT 2 AS sourceID, BLOG_COMMENTS.bID, BLOG_TOPICS.Topic_Title, BLOG_TOPICS.LFD,
I am using LINQ to EF and have the following LINQ query: var results
I have a query with the following syntax: select x.a as a, x.b as
I have the following data being returned from my database query: +---------------+-----------+------------------+--------------+-------+ | district_name

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.