Whidbey Collections

3/31/2004 10:50:59 AM

Whidbey Collections

With the introduction of generics, the designers seem to have acknowledge the poor design of the collection namespace and essentially used generics as a second change for redesigning the collections library. With generics, it is no longer necessary to even use the older namespace and I predict that its use will be relegated to working with older unmodifiable libraries. Even lists of objects should use the generic versions--List<object> instead of ArrayList.

However, I have only seen the introduction of one new collection class, LinkedList<T>, and it is not even in the technology previews bits. Only the help documentation contains any information on it; which is an indication that Whidbey has not yet reached code complete and development is still in progress.

IEnumerable<T> has been simplified by eliminating the Reset member.

Collections (via ICollection<T>) have been redefined to match the traditional VB usage of an unordered list with support for Add, Clear, Contains, Remove, and IsReadOnly. Support for rarely used synchronized methods have been removed.

Lists (via IList<T>) extend Collections by providing index access, insertion and removal. The net result is that it is virtually the same as originally IList minus Reset and the synchronization rountines.

A number of interfaces have been enhanced, such as IComparable which now includes both comparison and equality checking.

Some good news is that the number of operations on Lists and Arrays have been greatly expanded.
1) An AsReadOnly method returns readonly versions of lists
2) A number of new function operations such as ConvertAll, FindAll, Exists, ForEach, RemoveAll, TrueForAll and Sort that take a function as a parameter and iterates through all elements of the collection. This is very useful with alongside anonymous methods.
3) Arrays have a Resize method that constructs a new array and copies entries from the old array into the new array.

Comments

 

Navigation

Categories

About

Net Undocumented is a blog about the internals of .NET including Xamarin implementations. Other topics include managed and web languages (C#, C++, Javascript), computer science theory, software engineering and software entrepreneurship.

Social Media