Listing of Managed Processes

I just discovered a cool way of listing all processes that run managed code.    using System.Diagnostics; using System;   class Program {       static void Test() {         PerformanceCounterCategory clr = new PerformanceCounterCategory(“.NET CLR Memory”);         foreach(string process in clr.GetInstanceNames()) {             if(process != “_Global_”) {                 Console.WriteLine(process);             }         }    …


Rationale for Generic Type Parameter Naming Guidelines

The recent type parameter naming guidelines update resulted in a very lively discussion. I thought I would provide some rational for the recent changes. But first, I would like to first thank all of you who got involved in the debate. We have had debates like that for ages about many issues related to our products,…


Power Collections on GotDotNet Featured Sites

I just noticed that the Power Collections project made it to the “Featured Sites” on GotDotNet. See   For those who don’t know, Power Collections is a community open source library of advanced collection classes and algorithms. The project is co-sponsored by Microsoft. It has generated lots of good APIs (you can download a…


Design Guidelines Update: Names of Generic Type Parameters

After receiving lots of feedback from internal and external community (see here for example), we decided to modify the generic type parameter naming guidelines. The previous guidelines allowed only single letter type parameter names. The new guidelines allow and even encourage descriptive names.   Here are the new guidelines. Names of Generic Type Parameters Do…


IComaprer & IComparable Refactoring Proposal

We are exploring the possiblility of changing the design of IComparer<T> and IComparable<T> interfaces that will ship with Whidbey. This post describes some more detail on the issues we are trying to address with the design change and we are looking for feedback on the proposal. Background The first version of the .NET Framework had…


API Design Myth: Interface as Contract

I often hear people saying that interfaces specify contracts. I believe this is a dangerous myth. Interfaces, by themselves, do not specify much beyond the syntax required to use an object. The interface-as-contract myth causes people to do the wrong thing when trying to separate contracts from implementation, which is a good engineering practice. Interfaces…


Design Guidelines Update: Factories vs. Constructors

Joe has recently spent some time beefing up the Factory vs. Constructor guidelines. This subject has been the center of lots of intenral debates. Finally, we agreed on the fllowing: Factories The most common and consistent way to create an instance of a type is via its constructor. However, sometimes a preferable alternative is to use…


Design Guidelines Digest

Lots of people have asked me to create a short version of the Design Guidelines. Here it is. You can also email me directly at if you would like to get an MS Word copy of the digest, hich has a bit better formatting. [UPDATE: I recently updated this document and placed it online….


Design Guidelines Update: Evolving Managed APIs

Kit George (member of the BCL team) blogged an update that we just did to our Design Guidelines. The new guidelines talk issues related to evolving managed APIs. See  


System.Collections.Generic Dictionary Capacity, Hashing, and Collisions.

Somebody asked me a question how to set the initial capacity of System.Collections.Generic.Dictionary<K,V> if one knows that the Dictionary will contain 1000 entries.   The short answer   Dictionary<int,string> numbers = new Dictionary<int,string>(1000);   The long answer   Dictionary<K,V> is a generic type almost identical to the non-generic System.Collections.Hashtable. Both types are implemented as hashtables,…