If you reflect over the WPF System.Windows.Controls.Control
class you can see:
public class Control : FrameworkElement
{
internal ControlBoolFlags _controlBoolField;
// [...]
internal bool ReadControlFlag(ControlBoolFlags reqFlag);
internal void WriteControlFlag(ControlBoolFlags reqFlag, bool set);
// I think it's clear what they do
// [...]
internal enum ControlBoolFlags : ushort
{
CommandDisabled = 8,
ContainsSelection = 128,
ContentIsItem = 16,
ContentIsNotLogical = 1,
HeaderIsItem = 32,
HeaderIsNotLogical = 4,
IsSpaceKeyDown = 2,
ScrollHostValid = 64,
VisualStateChangeSuspended = 256
}
}
So I just want to know why MS chose this way to store the boolean values instead of using a bool
field for every flag.
Is it just their style of coding oder did they just want to save space for every field?
There's several reason. A couple include:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With