Call it a Clearest Code Challenge: What should InitializeComponent() look like?  What’s the best code you can imagine, that the WinForms designer should generate?

 

Let’s take a simple, concrete case: a form with an OK button. The button is anchored at the bottom right.

 

Let’s also pretend that the WinForms team has no trouble coding solutions to intractable problems.  For example, if you propose an InitializeComponent that solves the Halting Problem, your form will still show correctly in the designer.  This should free us from worry about what code analysis tools are capable of.

 

My last post gives us the seed code – the solution we produce today in Whidbey. 

 

May the Refactoring begin!