Evolving an API without breaking clients via extension methods, ObsoleteAttribute and EditorBrowsableAttribute

API evolution is tough and versioning is a complex enough issue that deserves not one but several posts. So I will only focus on one specific kind of evolution and backwards compatibility: Source Compatibility.

Let's say you have a class with a given functionality:

public class Mock
{
    public void VerifyAll()
    {
        // ...
    }
}

At a certain point, let's say you realize it was not such a good idea to have that method, and would rather have people using another method by default, but still being able to opt-in to the "old" behavior. One way of achieving this is to move this method to a new assembly (i.e. MyProduct.Legacy.dll), as an extension method:...

Read full article

Published 08 January 2009 12:15 PM by Daniel Cazzulino
Filed under: ,

Comments

No Comments

Search

Go

This Blog

News

     

      Microsoft MVP Profile

Syndication