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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:49:00+00:00 2026-05-24T06:49:00+00:00

I really love using the IEnumerable extension methods. But sometimes I end up with

  • 0

I really love using the IEnumerable extension methods.

But sometimes I end up with some collection that only implements IEnumerable and so they aren’t available. What is the easiest way to convert the collection to a form where I can use these methods?

And more generally, could someone explain to me exactly what the difference is between these two types and the history behind why these methods exist for the newer IEnumerable?

  • 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-24T06:49:02+00:00Added an answer on May 24, 2026 at 6:49 am

    Generally, use Cast() or OfType(). Both convert a non-generic IEnumerable to a generic one with the specified element type – the difference being how they convert each element. Cast will cast each element, which means it throws an exception if you ask it to perform a conversion it can’t handle. OfType simply skips elements which aren’t of the right type.

    For more information, see the Edulinq blog post about these operators.

    As for the difference between the two types – the non-generic one existed before generics, basically, and is therefore not typesafe; the Current property of IEnumerator is just object instead of a specific type. (Additionally, IEnumerator doesn’t implement IDisposable, whereas IEnumerator<T> does.) If you’re new to generics, that’s more than can easily be covered in an answer here…

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

Sidebar

Related Questions

I really love the philosophy of chaining methods, like jQuery emphasys in its library.
I really like DevX components, but they are pretty expensive, maybe anyone knows free
I'd really love the surrounding content to scroll up/down in like when using Scroll
I'm currently learning F# and I really love the yield! (yield-bang) operator. Not only
I am using Propel, a PHP ORM. I really like it. I love to
I have been using ruby exclusively for about a month and I really love
I've just started using Optimizely, and really love it. However, I need to do
I am absolutely happy with Scala and just love it :) But sometimes I
I just started using Coderush and found some stuff that I used to have
I love the way that Apple has the application purchase iAds. They look great

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.