Khaz said:
The most relevant use for them that you will find with custom RunUO programming is the performance increase with ArrayLists. ArrayLists require boxing and unboxing of types (Mobile to object, and back, for example). Generics allow list and structured storage of types without the need for casting, so list access is much more efficient. The drawback, however, is that any given list can only have its one defined type. Anyway, check out the article.
Well, not necessarily, the only thing that requires boxing and unboxing operations is to put or get an object on or off the Managed Heap that does not normally reside there (
e.g. Value Type's). So, if you wanted to store some struct in an ArrayList, it would need to be boxed to be added to it and unboxed when it is removed and cast back to the original type. If you wanted to store a Mobile in an ArrayList then no boxing or unboxing would need to take place as Mobile's are a class and as such instances of it are already on the Managed Heap.
Like you said though, a big win for the new collections using Generics is the casts that used to be necessary that can now be removed. Personally, though I don't see the ability to store only a single type to be constricting, I see it as being quite a bit nicer as there is now static checking of the types of objects being added to the collection. I think this is much nicer than the old-style collections where the onus was on you to make sure the types you added to the collection and the type that you removed it as are synchronized correctly and having any mistakes show up as a run-time error.
At the very least, if it is too constricting, you could always parameterize it with an interface or base class and add any types derived from them. You just need to note that if you do use an interface to store objects that aren't on the Managed Heap, you get the same boxing and unboxing operations that happened with ArrayList's storing them as Object's.