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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:56:00+00:00 2026-05-12T05:56:00+00:00

I have a large project which was originally written in C#1.1 and is now

  • 0

I have a large project which was originally written in C#1.1 and is now targeting C#2.0. There are several classes which have methods which take an ArrayList parameter I would like to start to move these to accept List<T> as a parameter, but this can’t be done all at one time, so I need to accept both parameters.

My main reason for the migration is so that List<> objects will be accepted as parameters, but I would also like to take advantage of type safety.

Have considered

1) Creating overloads and duplicating the code.
This has the advantage of allowing me to mark the old style code as obsolete, but obviously duplicating code is bad.

2) Changing the parameter to IEnumerable :
This has the advantage of working with both old and new code, but is not type-safe as it will accept List<T1> where it should be List<T2>

3) Re-writing the methods to take a List<T> parameter and writing a thin wrapper which takes an ArrayList parameter and copies the items to a new List<T> and then calls the main method. This also has the advantage of allowing me to mark the old style code as obsolete. It will have a slight performance/GC hit.

4) Creating three overloads. One private method which take IEnumerable and two public wrapper methods (one for ArrayList and one for List<T>) which just call the private method.
This also has the advantage of allowing me to mark the old style code as obsolete. Not sure whether it has any dis-advantages other than having three methods.

I am leaning towards 4, but am I overlooking anything?

  • 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-12T05:56:00+00:00Added an answer on May 12, 2026 at 5:56 am

    Definitely use a variant of #2, where you shoot for IEnumerable<T> rather than List<T>. For those that need more than IEnumerable<T>, your goal should be IList<T>.

    For those methods that can migrate to IEnumerable<T>, you can move them to just IEnumerable for the short term, and in this way avoid needing to maintain two copies of the method. Then, after most of your ArrayLists are gone you can complete the move to IEnumerable<T> with very little effort.

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

Sidebar

Related Questions

I'm working on a large project (for me) which will have many classes and
We have a fairly large C++ project which I am now in the process
I have a large XAML project which will have a main TabControl and each
I have a large project in Vb.net which drives a web browser control around.
I have a large-ish project that I'm working on which uses git as the
I have created a large Visual C++ 10.0 project which builds nicely within the
I have a project which uses a large library residing in its own repository.
I have a large project which I am compiling with GWT. During this process
I have a large project on a live server which I would like to
I have a large project which consumes a lot of WCF services. Endpoints are

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.