I'm decompiling a dll into C#. One of the decompiler generated project contains 1000+ buggy lines which one like below:
this.pictureBox1.BeginInit();
Error 385 'System.Windows.Forms.PictureBox' does not contain a definition for 'BeginInit' and no extension method 'BeginInit' accepting a first argument of type 'System.Windows.Forms.PictureBox' could be found (are you missing a using directive or an assembly reference?)
There is no BeginInit() method for regular Picturebox. I simply commented out the lines:
//this.pictureBox1.BeginInit();
Then I've examined another decompiler's output, it looks like below and VS compiler hasn't previous error:
((ISupportInitialize)this.pictureBox1).BeginInit();
Because of a crash, I couldn't export all sources at once with the second decompiler. Now I'm not sure what I have to do. I couldn't run & debug the project because of other errors need to be cleared first. My options are:
- Just comment out the lines.
- Modify and insert (ISupportInitialize) tag.
- Create an extension method if possible.
Last option seems easiest to me. Can I create BeginInit() extension method, will it work without any problem? And how can I implement & use ISupportInitialize?