Why we don’t recommend using List<T> in public APIs

We don’t recommend using List<T> in public APIs for two reasons. List<T> is not designed to be extended. i.e. you cannot override any members. This for example means that an object returning List<T> from a property won’t be able to get notified when the collection is modified. Collection<T> lets you overrides SetItem protected member to…

30

System.Collections vs. System.Collection.Generic and System.Collections.ObjectModel

Many people ask how the new.NET Framework 2.0 generic collections relate to the non-generic collections we shipped before. So, here you go. The most important types are in bold font. List<T> is basically a better ArrayList. It is optimized for speed, size, and power. Use it for majority of internal implementations whenever you need to…

24

Workflow Application Model

I just found a very interesting blog written by Dave Green (an architect of the Windows Workflow Foundation). One of the posts explains the main motivations for creating a workflow framework. In general I am a big fan of the work this team has done. I believe WWF will become the main application model for…


Value Type EventArgs

I just wanted to blog about some interesting API design discussion we had recently. We discussed whether to relax the event design guidelines to allow value type “event args.” This would make raising some events cheaper. public struct SomethingHappenedEventArgs {    public string SomeArgument { get; set; }} public class SomeType {    public EventHandler<SomethingHappenedEventArgs> SomethingHappened;} One implication…

6

Tracing APIs in .NET Framework 2.0

I found a very encouraging post about the new tracing APIs that we added to .NET Framework 2.0. Kathleen Dollard wrote: “Sometimes Microsoft absolutely amazes me. I know .NET is big, and I know that the 2.0 release is rather overwhelming even to Softies, but when there is a real jewel hidden in there, you’d…

1

PDC 2005 Summary

I just wanted to post something to summarize the PDC 2005. PDC started for me on Monday. Brad and I were presenting at a precon on Designing Reusable APIs. 6 hours total. The slides can be downloaded here. We were tweaking slides till midnight. When we were done, one of us dragged and dropped an…

1

The Role of the API designer: Design what the user needs

Since I have been preparing for the PDC and finishing the book, I neglected blogging. All ideas for posts were just ending up in the “to do” folder (yes, Outlook drives my life J). Now, I will try to catch up. I was reading Paul Grahm’s essay on Design and Research and I found this…


Framework Design Guidelines book went to print

I have just heard from the publisher that the Framework Design Guidelines book just went to print. To celebrate and to thank for the contributions, I thought I would blog the list of people who provided annotations for the book: Brad Abrams, Mark Alcazar, Chris Anderson, Christopher Brumme, Jason Clark, Steven Clarke, Joe Duffy, Patrick…

5

List<T> vs. ArrayList Performance

Rico just posted a new performance quiz where he compares performance of List<T> and ArrayList in some simple scenarios. List<T> is my Whidbey baby, so of course I had to answer that List<T> is faster 🙂