Partial types, please let me touch or at least add code to constructors.

Partial types are really cool but as they used in Whidbey to isolate dynamic code generate from designers from user code that implements events has some aspect that bother me. Designer generates the class construction of page and due to partial type limitations I can't write construction on my part of the class. This lives me just one way to add code into page constructor and that’s just by creating my own base page that pages will be derived from. While this solution works I found it clumsy. It would be wonderful if I can write my construction code on my part of class and that code will be embedded into the other partial type file constructor.

2 Comments

  • I saw a demo of VS2005 last night (from last Thursday's build) in which Jay Schmelzer showed us how you can copy the constructor from the partial class into your class file. And everything should still work. If you're in VB, you can also select the constructor from the method name drop down at the top of the code window.



    Now the question remains on if the designer mangles your custom code if requires a change to the constructor. The idea here is that it shouldn't. If doesn't work now, it's because its pre-beta.

  • How about the IDE just plain letting you view the rest of your partial type? EX: have fun trying to make your web form pages inherit from a custom class.

Comments have been disabled for this content.