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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:46:33+00:00 2026-06-09T13:46:33+00:00

I have a function whose return type is Table This code does not work.

  • 0

I have a function whose return type is Table

This code does not work. I just want to return the IEnumerable as Linq.Table **

 public static System.Data.Linq.Table<Products> GetProducts()
    {
        MyContext mc = new MyContext();

        Table<Products> ret = null;
        // Or   Table<Products> ret = mc.GetTable<Products>();

        ret.AttachAll<Products>(mc.GetTable<Products>()
                                  .OrderBy(p => p.ProductID).Take(1));

        return ret;
    }

Now I want to cast IEnumerable query to System.Data.Linq.Table.

(You may say that I can change the return type but the question is whether this is possible. Can I override some function like GetTable()? )

  • 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-09T13:46:35+00:00Added an answer on June 9, 2026 at 1:46 pm

    You can’t. The Table<TEntity> class exists in order to provide an IQueryable<T> interface implementation. There aren’t any actual items in there, it’s just a root that’s exposed by the DataContext class in order to provide an IQueryable<T> implementation which is interpreted, translated to SQL and then sent to SQL server.

    If you have an IEnumerable<T> interface implementation, chances are you already have the materialized result set (or an in-memory collection) that you are iterating over. There’s no benefit to having an IQueryable<T> implementation because there’s nothing to interpret; everything you want is already in memory.

    That said, it’s probably better to just use the regular extension methods/query syntax off your IEnumerable<T> implementation than trying to put it in a Table<TEntity>.

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

Sidebar

Related Questions

i have build a small function whose work to get value in alert box
I have this piece of code // TR Fading when deleted $('.delete').live('click', function() {
I have java API which return this type: ArrayList[ArrayList[String]] = Foo.someJavaMethod() In scala program,
I have a javascript function: string.prototype.startsWith = function(str) { return (this.indexOf(str) === 0); }
I would like to return a std::function whose type is dependent on the type
I have a function whose input argument can either be an element or a
I have a function in my namespace, ns::foo , whose job is to dispatch
I have an activity in whose onCreate method an Init function is called (the
function abc() { document.form1.1.disabled=true; } I have a select box whose id is 1
I have function like this: function ypg_delete_img($id, $img) { $q = $this->ypg_get_one($id); $imgs =

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.