Edward Diener wrote:
> Carl Daniel [VC++ MVP] wrote:
>> Edward Diener wrote:
>>> I looked in the documentation for System.ComponentModel.Component's
>>> constructor but I only noticed a constructor taking no parameters.
>>> My understanding is that there is a second constructor which takes a
>>> System.ComponentModel.IContainer interface object. Has this been the
>>> case in previous .NET releases and has this changed with .NET 2.0 ?
>>
>> Ildasm shows only the no-args constructor for V1.1 and V2.0. Why do
>> you believe there's another constructor?
>
> If I use VS2005 to generate a component class, it creates both a no
> argument constructor and a constructor which takes a
> System.ComponentModel.IContainer container interface with the comment
>
> "///
> /// Required for Windows.Forms Class Composition Designer support
> ///"
>
> This leads me to believe that all component derived classes need to
> specify this second constructor. As a component developer I have added
> this second constructor to all my components, with the appropriate
> logic of adding the component to the container passed in the
> constructor. Is this necessary ? What is the story with this second
> constructor ? I could find no documentation regarding it in the
> VS2005 doc for any .NET component classes.
IIUC, it has no function outside the windows forms designer - effectively an
internal implementation detail of the designer that leaks into your code.
-cd
|