0

I have a custom WinForms control inherited from the WinForms Control class. The control also explicitly implements the System.ComponentModel.ISupportInitialize interface used by the WinForms Designer to insert the corresponding BeginInit/EndInit method calls in the designer's generated code:

public partial class MyControl : Control, ISupportInitialize
{
    void ISupportInitialize.BeginInit()
    {
        //...
    }

    void ISupportInitialize.EndInit()
    {
        //...
    }
}

Is there any difference in the explicit or implicit implementation of ISupportInitialize in controls used at design time?

I tried to find an answer in the source code of native .NET components, but found both ways of the interface implementation. For example, DataGridView uses the explicit implementation like me, but FileSystemWatcher does it implicitly. So, is there any difference?

TecMan
  • 2,743
  • 2
  • 30
  • 64
  • Do you mean an explicit (private) implementation as `void ISupportInitialize.BeginInit() { /* set some initial state */ }` and the public implementation, as `public void BeginInit() { /* Set states / Set run-time properties / call methods */ }`, which can be called to reset / re-initialize a component at run-time? – Jimi Nov 16 '22 at 17:21
  • @Jimi, yes. I think that the terms "explicit" and "implicit" are completely definite when we talk about interface implementation. – TecMan Nov 17 '22 at 06:33

0 Answers0