Friday, September 28, 2007

Partial methods

Visual Studio 2008 allows the use of partial methods. Partial methods are nothing but a compiler trick (just like partial classes). Designer generated code can provide hooks into their class methods, by using the partial keyword. Users of the class can then hook into those methods and provide their own implementation. When a partial method has no body then the partial method is not emitted to metadata. So in a sense they are optional methods.

Check out this video on partial methods titled: Partial Methods in C#3 and VB9 by Daniel Moth. In it he explains what partial methods are and their limitations. He also compares them to the Conditional attribute and event handlers.

Technorati Tags: ,

No comments:

Post a Comment

Post a Comment

Subscribe to my feed in your favorite feed reader