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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:28:24+00:00 2026-05-12T18:28:24+00:00

So, both ListBox.ObjectCollection and ListView.ListViewItemCollection implement the IList class, which provides Add and Remove

  • 0

So, both ListBox.ObjectCollection and ListView.ListViewItemCollection implement the IList class, which provides Add and Remove methods but no AddRange, InsertRange, or RemoveRange. However, ListBox.ObjectCollection and ListView.ListViewItemCollection also provide an AddRange method — just no InsertRange or RemoveRange.

Look at the ArrayList class, on the other hand, which on top of implementing IList also provides AddRange, InsertRange, and RemoveRange. The same difference exists between the generic forms of this class and interface, List<T> (which has AddRange, InsertRange, and RemoveRange) and IList<T> (which only provides Add and Remove).

I can understand the IList and IList<T> interfaces not providing AddRange, etc. — it’s just an interface; anything beyond the minimum requirements of Add, Remove, RemoveAt, etc. is optional. But, given the usefulness of the *Range methods for the ArrayList and List<T> classes, and considering how handy they’d be for ListBox and ListView controls, I wonder why they don’t exist for these controls.

Does anyone know? Is there something about the internal implementation of InsertRange and RemoveRange that makes these methods somehow less efficient, more complicated, or otherwise less appropriate for ListBox.ObjectCollection and ListView.ListViewItemCollection than AddRange?

To be clear: I’m not looking for speculation of the “Looks like someone at Microsoft got lazy” variety; rather, I’m wondering if anyone actually knows of a legitimate difference between AddRange and InsertRange/RemoveRange that might explain the absence of these latter methods from ListBox.ObjectCollection and ListView.ListViewItemCollection.

  • 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-12T18:28:24+00:00Added an answer on May 12, 2026 at 6:28 pm
    1. In general it’s a pretty uncommon scenario to use InsertRange and (even more so) RemoveRange. Should RemoveRange, for example, remove the given range only if there is a continious range of elements similar to the given range, or should it remove the given elements one by one?

    2. These methods are usually easy to implement if you need them. With the help of the extension methods you can have them to look almost like the native methods.

    3. There are no signs in the code, showing that it would be complicated to implement those methods (just as thousands of other “useful” methods). Actually, the ListView implementation of InsertItems even takes an array of items already under the hood. Just the standard ListViewItemCollection.Insert() always provides array with 1 element. Take a look with the Reflector to the ListViewNativeItemCollection.Insert():

       public ListViewItem Insert(int index, ListViewItem item)
       {
           //Various checks excluded ....
           this.owner.InsertItems(index, new ListViewItem[] { item }, true);
           //More code excluded .....
           return item;
       }
      

    I guess it just wasn’t that important to implement that feature… so they didn’t.

    As Eric Lippert likes to say: “because no one ever designed, specified, implemented, tested, documented and shipped that feature”.

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

Sidebar

Ask A Question

Stats

  • Questions 226k
  • Answers 226k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Lazy initialisation. .NET 4, when it arrives, will have a… May 13, 2026 at 1:08 am
  • Editorial Team
    Editorial Team added an answer After digging through MSDN, all I needed to do was… May 13, 2026 at 1:08 am
  • Editorial Team
    Editorial Team added an answer Since you want to include the content part as well,… May 13, 2026 at 1:08 am

Related Questions

I am using two ListBox controls in my WPF window that are identical (identical
I've got a Windows Forms application with two ListBox controls on the same form.
in ASP.NET, I've bound a listbox control to a List of custom class (consisting
So i have a combo box on the main window of my WPF app.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.