My Current Favorite Class... ArrayList
When ever I start a new project I select the custom Library project with a reference to VBCorLib already selected. I don't even give it a second thought. I just expect the functionality to be there. So with all of that functionality available to me what do I usually use first?
Well, when creating a class that contains items I reach for the ArrayList first. Why? I know I could use the Collection class or an array. Do I just feel safer with an ArrayList? Maybe it's because I know how it works and it's about as effecient as can be with indexed lookups? Or maybe it's because it has all sorts of list manipulation capabilities that I feel like I won't have to change the type of collection or add additional functionality to manage a different collection type later on in the coding process.
In my current project I store objects. It's easy enough to store them in any type of container, but I needed one functionality and didn't want to have to code too much. I needed to be able to sort the objects in the list. Immediately the Collection class is out. Oh sure you could sort it using the hardest method possible. I could easily sort an array of objects using VBCorLib. But, when it comes down to it, I don't like having to manage an array directly. So, unless there is a pressing reason for the quickest access to the objects in a list, I choose an ArrayList and provide a custom IComparer object when sorting the items. What could be easier?
I use other classes in VBCorLib, but my first class is usually the ArrayList allowing for easy manipulation of list data.
-Kelly
Well, when creating a class that contains items I reach for the ArrayList first. Why? I know I could use the Collection class or an array. Do I just feel safer with an ArrayList? Maybe it's because I know how it works and it's about as effecient as can be with indexed lookups? Or maybe it's because it has all sorts of list manipulation capabilities that I feel like I won't have to change the type of collection or add additional functionality to manage a different collection type later on in the coding process.
In my current project I store objects. It's easy enough to store them in any type of container, but I needed one functionality and didn't want to have to code too much. I needed to be able to sort the objects in the list. Immediately the Collection class is out. Oh sure you could sort it using the hardest method possible. I could easily sort an array of objects using VBCorLib. But, when it comes down to it, I don't like having to manage an array directly. So, unless there is a pressing reason for the quickest access to the objects in a list, I choose an ArrayList and provide a custom IComparer object when sorting the items. What could be easier?
I use other classes in VBCorLib, but my first class is usually the ArrayList allowing for easy manipulation of list data.
-Kelly