ISupportInitialize.BeginInit/EndInit should be virtual
See original GitHub issueSince View is intended to be heavily inherited to create new types of views, it would be quite convenient to be able to override BeginInit
and EndInit
, so that additional automatic initialization can be performed.
This is the typical pattern for interfaces that can be of use to derived classes (i.e. IDisposable and the virtual Dispose impl.).
If desired, the interface implementation can be made explicit and a protected virtual member can be exposed instead, to preserve the base class behavior even if overriden. The former is simpler, but the latter might be more solid if the base View performs critical work on its BeginInit/EndInit pair.
(I can send a PR with whichever approach is deemed more appropriate)
Issue Analytics
- State:
- Created 10 months ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How to correctly override ISupportInitialize implementation
The problem is, that the interface is explicitly implemented from microsoft and so i cannot call the BeginInit() and EndInit() Methods of the ......
Read more >BeginInit and EndInit creating errors
Recently I have been working on adding to my ribbon BarSubItem some buttons, and now one day when I tried to open the...
Read more >BaseControlArray.ISupportInitialize.BeginInit Method
Using the BeginInit and ISupportInitialize.EndInit() methods prevents the control from being used before it is fully initialized.
Read more >ISupportInitialize.BeginInit problems?
Fix an exception related to ISupportInitialize. ... This indicates that the BeginInit/EndInit calls are an optimization and it should be OK ...
Read more >[RESOLVED] How to declare variables in "Initialization" ...
ISupportInitialize ).BeginInit() StateItem2.Mode = VisiWinNET.DataAccess.ItemMode.Value StateItem2.Name = "Ch1.Machine04.Application.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
These all sound like good solutions. I think I’ve been converted from my initial response and I’m now feeling that simplicity might be the best and simply marking them virtual as @kzu first suggested.
If someone forgets to call
base.BeginInit
then its not really our responsibility to complicate our API to prevent that. And it is the most flexible.The
OnInitializing
bit seems like a nice addition too.Wow @kzu great API packages you have done and doing, fantastic. Don’t give up creating useful libraries, please. Thanks.