Live Chat Icon For mobile
Live Chat Icon

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?

Platform: WinForms| Category: Tips

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 constructor, myArrayList will be initialized.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.