I'm getting some strange errors trying to make use of a vendor dll written probably in another language, and it made me wonder. For a non static class constructor, at what moment is its constructor called. Does this happen as soon as new is called (i used to think this).
public void initTool()
{
vendorClass x = new vendorClass()
int i =0;
i++; ....
Or might it perhaps happen earlier in the code like in the main form type definitions, where x could be defined as that vendor class (thus defining something would trigger constructor code parts to run on beforehand). Perhaps a result of jit optimization or so
public partial class Form1 : Form
{
vendorClass x; // or vendorClass x=null;
int i; ...
MSDN seams to say that "new" keyword is required in case parameters should be passed into the constructor. However what if it doesnt need that?, in such a case will a dll class constructor be called at the moment of reserving it?.
Note this vendorClass.dll is not in C# written in C++ or plain C, and i dont have the code of it