June 20, 2007
03:19 PM
void Test(out SomeDelegate d1, out SomeDelegate d2)
{
    object a = new ObjectGraph();
    d1 = delegate { return a; };

    object b = new ObjectGraph();
    d2 = delegate { return b; };
}

This contrived method is the potential root of some undesired characteristics in a program.

  • What is the problem? (hint: ildasm is your friend)
  • How can we refactor the method to avoid it?
© Douglas Stockwell 2007
Creative Commons License Unless otherwise specified all "source code" examples are available for use under the Creative Commons Attribution-Noncommercial 3.0 License. Please contact me if you would like more flexible licensing terms.
Messenger Presence