static void Main()
{
Employee e =new Employee();
}
public class Employee
{
static int counter=0;
double mydata = 500;
private string _FirstName;
public string FirstName {
get { return _FirstName; }
set { _FirstName = value ; }
} private string _LastName;
public string LastName {
get { return _LastName; }
set { _LastName = value; }
}
public double CalculateValue() {
double _local=10; mydata=mydata * _local; return mydata ;
}
}i appologised that my question is not related with web rather generic c# and memory allocation.
1) i just like to know when i will run my program then who call the static main() function
2) when employee class instance will be created then how memory will be allocated for this class?
3) where this variable will store in heap or stack ?
static int counter=0;
double mydata = 500;
private string _FirstName;
4) where _local variable will be store when calculatevalue will be called ?
5) the important things is where data is stored when we assign data to variable. in stack or heap ?
suppose i have variable called Name="Hello" or Salary=5000 where Hello & 5000 as value will be stored ? heap or stack ?
6) where static variable is stored declared in class?
7) static class load into memory when program just run even if i do not call or use them ?
i heard that memory is allocated when we create instance of non-static class. so in case of static class we can not create instance so how they load into memory. just automatically by CLR when program just invoke or when we use that static class first time
? please explian. thanks