Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ resources

18. Windows Forms Tips

18.22 Its possible that some of my class members will not be initialized when one of my virtual members gets called even before the constructor. How can I avoid this?


If possible, initialize them in-line:

     public class MyClass
     {
          public ArrayList myArrayList = new ArrayList();

          public MyClass(){}
     
          public override void MyOverride()
          {
               // When this gets called by the base class construcotr, myArrayList will be initialized.
          }
     
     }