i wrote code and get strange result- integer i is 8:
unsafe
{
int i = sizeof(Point);
}
After checking struct Point i found this fields:
public bool IsEmpty { get; }
public int X { get; set; }
public int Y { get; set; }
bits math: 32+32+1 = 65 bits, so is > 8 bytes
So, why sizeof returns 8 , but not 9?
Thanks
IsEmpty
is a property, not a field. Properties are just methods behind the scenes, so they're not part of the size of a structure.