Generic List enumerator order [Vance Morrison]

“Is the order returned by the List<T> enumerator guaranteed to be the same as looping through with a for loop?” Since foreach is actually defined in terms of looping over the ‘MoveNext’ operation of the enumerator, foreach is guaranteed to be equivalent to doing the enumeration by hand regardless of the implementation of the enumerator….

1

No Virtual Members on Generic Collections [Ryan Byington]

A customer asked me why we decided to make the members on our generic collection non virtual when every member on the non generic collections was virtual. I though other might be interested in this so I decided to answer it here.   When we shipped the first version of the .NET Framework we wanted…

5

Avoiding Boxing in Classes Implementing Generic Interfaces through Reflection [Dave Fetterman]

Krzysztof Cwalina showed me this cool trick to avoid boxing value types when working with generics and interfaces.This may be a bit dense but the trick is rarely seen and illustrative.  Note before proceeding: This technique is only available in VS.NET Whidbey.  For the sake of illustration, suppose in .NET there were a notion of…

6

Synchronization in Generic Collections [Brian Grunkemeyer]

A few astute users of our generic collections observed that we no longer provide a public SyncRoot property on ICollection<T>.  I believe we’re better off not providing it.  You often want to do synchronization at some higher level in your application, not just on one collection. I’ve recently been writing an FxCop rule that modifies two…

13

Extra! Extra! Generics CLS-compliant in Whidbey! [Peter Drayton]

As you may have already heard, the November CTP of Visual Studio 2005 Standard Edition was posted for MSDN subscribers earlier this month. CTPs are unsupported, pre-release software – and also a great way to get an early look at what’s coming down the pike in the next full beta (Beta 2 in this case)….

31

.NET Arrays, IList<T>, Generic Algorithms, and what about STL? [Brian Grunkemeyer]

When we were designing our generic collections classes, one of the things that bothered me was how to write a generic algorithm that would work on both arrays and collections.  To drive generic programming, of course we must make arrays and generic collections as seamless as possible.  It felt that there should be a simple…

4

KeyValuePair vs. DictionaryEntry [Krzysztof Cwalina]

We discussed a problem with implementation of IEnumerable on Dictionary<K,V>. What type should IEnumerable.GetEnumerator().Current return? KeyValuePair<K,V> or DictionaryEntry? Same for ICollection.CopyTo. Instances of what type should be copied to the array? We decided the following: IEnumerable and ICollection interface implementations will use KeyValuePair<K,V> as the item type. IDictionary specific members (GetEnumerator returning IDictionaryEnumerator) will use…

2

New BCL features in Beta1

[Ahmed AbouTaleb] Here is a list of all the new BCL features that shipped in Visual studio 2005 Beta1 Regular Expressions We added the ability to use character class subtraction to regular expressions. The specification is publicly available here.   Compression Support We have added the ability to compress, and decompress streams using the standard GZip and…

12

Adding a generic version of ArrayList [Kit George]

Recently, Olivier Le Pichon queried whether we were considering adding a generic version of ArrayList to the BCL. The answer simply is ‘yes we are!’. If you can get yourself a hold of the PDC bits for Whidbey, then you can check out the System.Collections.Generic.List class, and associated collections also.

0