by Dominic Zukiewicz
23. January 2008 14:25
A simple question.
The bool values are true or false. Easy yes?
How many bytes does it occupy? 4 bytes? 2 bytes? 1 byte?
The actual answer is 1 byte, which you may expect, but the MCTS Application Development Framework exam states that the width of this field is 4 bytes!
So how do we settle it? Even easier.
Console.WriteLine("bool is {0} byte(s) long.", sizeof(bool));
//bool is 1 byte(s) long.
Console.WriteLine("System.Boolean is {0} byte(s) long.", sizeof(System.Boolean));
//System.Boolean is 1 byte(s) long.
95266a63-f76a-4af8-b354-b0b7073dd298|0|.0
Tags:
Framework