The Module, a new Design Pattern ? 25 Apr 2005



I'm partially enthusiast about the partial classes. Here is a sample of code that a French Microsoftee presented to us :

public partial class Person
{
    public string firstname;
    public string lastname;
        
    public Person (string firstname, string lastname)
    {
        this.firstname = firstname;
        this.lastname = lastname;
    }
    
    public void Format ()
    {
        // ...
    }
}

public partial class Person
{
    public static Person FromDataRow (DataRow r)
    {
        // ...
    }
    
    public static Person FromAnotherDataSource (DS s)
    {
        // ..
    }
}

Isn't it a neat design ? Grrrr, I know this is only a sample, to explain the partial keyword, but i know that lots of people will use it this way. Please, use only the partial keyword where it is meant to be.