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

  • Home
  • SEARCH
  • 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 8904391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:07:06+00:00 2026-06-15T02:07:06+00:00

Basically I’m converting a SQL datatable to a generic list which I can successfully

  • 0

Basically I’m converting a SQL datatable to a generic list which I can successfully do. But I can’t figure out how to return the the list object. I get a error that say’s a variation of- Cannot implicitly convert type System.Collections.Generic.IList to System.Collections.Generic.List

What would be the correct way to return theList as type List?

public List<MyObject> GetAllMyObjects()
{
    String command = "select * from names ";
    DataTable tableResult = DataTableToList.ExecuteDataTable(command, CommandType.Text, null,connectionString);

    IList<MyObject> theList = DataTableToList.ConvertTo<MyObject>(tableResult);

    return // I’m not sure how to return theList here...
}
  • 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-06-15T02:07:07+00:00Added an answer on June 15, 2026 at 2:07 am

    Call ToList on your theList object.

    return theList.ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I would like a brief explanation of how I can access a SQL
Basically, I have a list of delivery checkboxes one for deliver to this address
Basically I have converted a tab delimited txt file into a list containing a
Basically I am trying to do this: <Trigger Property=Item Value={c:CollectionView.NewItemPlaceHolder}> But the syntax is
Basically, I want to modify the constructor of the Object class. Since every class
Basically i'd like to allow an arbitrary (but not empty ) number of key-value
Basically I'm making a filter for my portfolio so that you can click on
Basically what I want to do is get a list of stores the employee
Basically, I'm developing a note-taking app where the user can type as long as
Basically what I am doing is giving a user a list of terms via

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.