且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么C#中bool数据类型的大小不是只有1位?

更新时间:2021-07-08 01:43:53

是因为值的最小可寻址"大小是一个字节

Is it because the smallest 'addressable' size of a value is a byte

是的,完全一样.为了使CLR高效,它以与C ++中的编译器相同的方式(非常多)将其数据类型映射到本机数据类型.

Yep, exactly the same thing. In order for the CLR to be efficient, it maps its data types to the native machine data types in much the same way as the compiler does in C++ (pretty much).