There is one confusion in my mind, about the constructor of class. How ever I tried to find this but doesn't find any answer relevant to my confusion..
Suppose I have a class
public class mySampleClass
{
public mySampleClass()
{
// This is the constructor method.
}
// rest of the class members goes here.
}
which have many properties, when I initialize this class what happen? I mean to say whether only constructor is being called? or something else?
what about rest of the properties? i am asking this foolish question because of my WCF service, which contain many methods, in every methods I have initialize same class, if I make object globally it crashes some where.
My other question is how many time it takes to initialize new instance of constructor? depending of all code? or whether constructor body?
Please elaborate with some Example. with two constructor or many.
UPDATE :
There is some confusion Regarding this Question, I have simply share one Scenario like WCF services, but I have to known all over constructor initialization Time, whether it depends on constructor? or all over object (containing other methods properties).
In simple words
I want to know constructor behaviour when it is initilize whether it is depend on Properties, Method etc?