class a
{
int variable;//4 bytes
}
class a
{
static int variable;//? bytes
}
views:
91answers:
4
+5
A:
The int variable also occupies 4 bytes, just not in the same place as the class and it occupies 4 bytes for each AppDomain, not for each instance of the class.
Timores
2010-03-15 12:11:22
+1
A:
4 bytes for every appdomain it is loaded into. NOT counting the overhad of the carrying class, which is assume to be thereanyway (i.e. you will not have JUST the static variable in it).
TomTom
2010-03-15 12:13:29
A:
It depends on the hardware, as an int is not always 4 bytes. On x86 the static int takes the same number of bytes as as a non-static one.
You should probably use sizeof() or something like that if you are trying to allocate memory.
Oliver
2010-03-15 12:55:07
int in the DotNet framework always goes to four bytes.
Martin Milan
2010-03-15 12:57:03
if you are talking about cpu bandwidth, then you are right.
Behrooz
2010-03-15 18:44:05