The new partial types feature in the Whidbey release of C# will make RAD-style development more seamless. Rather than hide generated code using #region directives, generated code can simply live in an external file that can be managed by the IDE. Developers can write code without ever having to see the generated code, which should make it harder for folks to inadvertently modify tool-generated code.
5 archived reader comments
Rick Childress (2003-07-02)
RE: C# futures
I can dig partial types, but explain anonymous methods to me.....
Gerald Nunn (2003-07-03)
Personally, I would not want code to be hidden from me, generated or not. In my mind, the generated code should either be two way, similar to the JBuilder RAD designer, or they should stick the RAD elements in a non-code based resource file similar to the approach Delphi takes.
John Lam (2003-07-03)
Gerald, if you’re doing ASP.NET development, there’s a TON of generated code that’s hidden from you. And most folks don’t seem to mind.
Two-way tool stuff breaks from time to time as well (the IDE gets out of sync with the sources). That’s a pretty serious problem, so it would be nice if the generated code could not be “accidently” touched by someone. You’ll always (I presume) have the option in the IDE to reveal the hidden code.
John Lam (2003-07-03)
Rick, anonymous methods make sense for “inline” event handlers. There’s really no sense polluting the namespace of a class with arbitrary method names like “
button1_onclick” if YOU never callbutton1_onclick() from any of your other code.Rick Childress (2003-07-08)
Right, that’s the line. Just don’t understand how that improves my life…
I don’t have the Whidbey bits, but I would imagine since anonymous methods are inline and all the delegates are set up by the forms designer code that the method code will reside in the forms designer ‘no-touch’ region? That would be a pain because I rarely (if ever) bother expanding that code region. Besides, I don’t like to use the default ‘
button1_onClick()’ I usually rename it to something more aesthetically pleasing (OnCancelClick).