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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:57:17+00:00 2026-06-17T17:57:17+00:00

I am using Simple.Data and want to know if I can Select a single

  • 0

I am using Simple.Data and want to know if I can Select a single column and then cast it to a list of string values. For example using the query below I get the error:

Cannot implicitly convert type ‘Simple.Data.SimpleRecord’ to ‘string’

var result = _database.ParentRegionList.All()
            .Select(_database.ParentRegionList.RegionName)
            .Where(_database.ParentRegionList.RegionName.Like(startsWith + "%"))
            .Distinct()
            .ToList<string>();

However if I create a class LocationAutoComplete that has a single public property “RegionName” of type string then the cast works fine.

var result = _database.ParentRegionList.All()
            .Select(_database.ParentRegionList.RegionName)
            .Where(_database.ParentRegionList.RegionName.Like(startsWith + "%"))
            .Distinct()
            .ToList<LocationAutoComplete>();
  • 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-17T17:57:18+00:00Added an answer on June 17, 2026 at 5:57 pm

    The ToList<T> Simple.Data method expects you to be casting the contents of a SimpleRecord to an object, which is why it works with your LocationAutoComplete class. Full details can be found here.

    If you are returning only one field which you wish to return as a scalar value or a list of scalar values, use the ToScalar<T> or ToScalarList<T> method instead. Full details can be found here

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

Sidebar

Related Questions

Using EF we can use LINQ to read data which is rather simple (especially
I'm writing a simple data UI using standard .Net databinding to a typed DataSet
I'd like to serialize some simple data model into xml, I've been using the
so im using a simple submit binding to pass a function data: <form data-bind=submit:
I'm trying to make a simple tabular data layout using a QTableView with a
I'm looking for a simple solution using Python to store data as a flat
I'm trying to make simple script using jquery $post function to pass data to
In my simple class I'm using data annotations to map properties to columns as
Here is a simple form I am using to send XML data in admin_xml.php
Hi I have built a simple WCF application I am using to query data

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.