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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:55:10+00:00 2026-06-04T09:55:10+00:00

I am using an external library thats returns a IEnumerable . After I have

  • 0

I am using an external library thats returns a IEnumerable. After I have recieved them I would like to add some models to the end. That only seems possible when using an IList or some other collection. So when i’m trying to convert the IEnumerable to a list using the .ToList() method it returns an IEnumerable. That’s not the what I expected? Am I using .ToList() correct? Or what else would solve my problem?

This is my code i have so far:

IList<Models.Browser.Language> languages = GetLanguages(dateDrom, dateTo).ToList();
IList<Models.Browser.Language> primaryItems = languages.Take(10);

This last line produces an error saying:
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<Bogus.Models.Browser.Language>' to 'System.Collections.Generic.IList<Bogus.Models.Browser.Language>'. An explicit conversion exists (are you missing a cast?)

Thanks in advance!

  • 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-04T09:55:11+00:00Added an answer on June 4, 2026 at 9:55 am

    The value of languages is a reference to a List<>, but then you’re calling Take(10) on that, which doesn’t return a list.

    Just move your ToList() call:

    IEnumerable<Models.Browser.Language> languages = GetLanguages(dateDrom, dateTo);
    IList<Models.Browser.Language> primaryItems = languages.Take(10).ToList();
    

    Or just do it in one call:

    var primaryItems = GetLanguages(dateDrom, dateTo).Take(10).ToList();
    

    Also, this isn’t quite correct:

    After I have recieved them I would like to add some models to the end.

    An alternative is to use Concat. For example:

    var items = GetLanguages(dateDrom, dateTo).Take(10).Concat(fixedItems);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Qt project and would like to use an external library that
I have a problem; I'm using an external library where one particular event has
I would like to clone a tag using Javascript (without using any external frameworks
I am currently using an external library function that returns a File object. This
I have a java program using an external library. The main program uses log4j
I have an external library made using C code. I wish to call a
In my application I'm using an external library (Batik 1.7) that is made up
I am using the external library IMAPClient. When the login fails, i see this
Is there any external library using which one can edit and save XML files
I'm using http://pdfobject.com/ jquery library to load the external pdf files into an html

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.