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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:12:15+00:00 2026-05-13T09:12:15+00:00

If a method takes a parameter of type System.Collections.IList can I legitimately/safely pass a

  • 0

If a method takes a parameter of type System.Collections.IList can I legitimately/safely pass a value of type System.Collections.Generic.IEnumerable<T>?

I would appreciate a thorough explanation of why this is possible and what actually happens to the object T when the IEnumerable<T> is used inside of the method.

Is it converted to the base type of Object?

Is it used as an System.Collections.IEnumerable?

Are there any scenarios where this will cause problems (i.e. performance issues)?

Thanks in advance,
John

  • 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-13T09:12:16+00:00Added an answer on May 13, 2026 at 9:12 am

    No, You cannot pass an IEnumerable<T> to a method which takes IList. The interface IEnumerable<T> is not convertible to IList and attempting to pass a variable of type IEnumerable<T> to a method taking IList will result in a compilation error.

    In order to make this work you will need to do one of the following

    1. Instead of having an IEnumerable<T>, maintain a reference to a type which implements both IEnumerable<T> and IList. List<T> is a good candidate here
    2. Convert the IEnumerable<T> instance to a new object which is convertible to IList. For example, in 3.5+ you can call the .ToList() extension method to create a new List<T> over the enumeration.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I pass a parameter to a Java method with a raw type
I need to write a tree search method which takes a type parameter T
I would like to write a cast method in Eiffel which takes 'the type
I consider refactoring few method signatures that currently take parameter of type List or
I have a static method that takes a parameter and returns a class. the
In this case, the Visual Studio designer generates a method which takes the parameter
In Boo, let's say I'm overriding a method that takes a parameter that takes
I have a method which takes an array of strings as parameter and queries
I'm trying to invoke a method that takes a super class as a parameter
How can I specify that a method should take as parameter a pointer to

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.