views:

91

answers:

4
class a
{
int variable;//4 bytes
}

class a
{
static int variable;//? bytes
}
+1  A: 

The same number of bytes.

Andrew Bezzub
+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
+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
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
int in the DotNet framework always goes to four bytes.
Martin Milan
if you are talking about cpu bandwidth, then you are right.
Behrooz