Archive for October, 2007

Efficient usage of WCF clients

Sunday, October 28th, 2007

Wenlong has an excellent writeup of how write a WCF client with an eye towards performance.

Congrats Babajob!

Wednesday, October 10th, 2007

I’m very proud of my friend Sean. For as long as I can remember, Sean has been very passionate about the “social” aspects of computing, He has been living in India for the past few years, and was inspired to apply social computing to help India’s poor. And today Babajob received front page coverage in the International Herald Tribune. Congrats Sean!

Behind the protected BindingElement ctor

Thursday, October 4th, 2007

On our BindingElement class, there is a protected ctor that takes another BindingElement as its parameter. This constructor exists in order to facilitate a composable implementation of BindingElement.Clone.  When writing a custom binding element, first implement a protected copy constructor as follows (note that for sealed classes this ctor should be private):

protected MyBindingElement(MyBindingElement elementToBeCloned)
   : base(elementToBeCloned)
{
 
// copy all fields from elementToBeCloned.XXX to this.XXX
}

Then you should implement your Clone() method as follows:

public override BindingElement Clone()
{
  return new MyBindingElement(this);
}

Any BindingElement in your inheritance chain (assuming it has followed this pattern) will then copy over the relevant values in its copy constructor, so that you can be assured a full Clone of your custom binding element.