Basic question about memory allocation
-
-
I have a very basic question. If I declare some variables in my class and just run my C#.Net program, without any work done in it, will it allocate a memory for these variables? For Example, Class abc { public int a; public double b; } Regards, Anil
-
Does that mean, when we include say System.Data.SQLClient namespace on the top of our class, it copies all the classes inside this namespace at runtime and allocates memory accordingly even if we don't use anything in it? Regards, Anil
-
Does that mean, when we include say System.Data.SQLClient namespace on the top of our class, it copies all the classes inside this namespace at runtime and allocates memory accordingly even if we don't use anything in it? Regards, Anil
A M SOMAN wrote:
Does that mean, when we include say System.Data.SQLClient namespace on the top of our class, it copies all the classes inside this namespace at runtime and allocates memory accordingly
It will allocate memory once you create instance for it.
class1 c1;
won't allocate any memory. Butclass1 c1 = new class1()
will allocate memory space.