Quantcast
Channel: What is the size of a boolean In C#? Does it really take 4-bytes? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Hans Passant for What is the size of a boolean In C#? Does it...

The bool type has a checkered history with many incompatible choices between language runtimes. This started with an historical design-choice made by Dennis Ritchie, the guy that invented the C...

View Article



Answer by Jon Skeet for What is the size of a boolean In C#? Does it really...

Firstly, this is only the size for interop. It doesn't represent the size in managed code of the array. That's 1 byte per bool - at least on my machine. You can test it for yourself with this code:...

View Article

What is the size of a boolean In C#? Does it really take 4-bytes?

I have two structs with arrays of bytes and booleans: using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential, Pack = 4)] struct struct1 { [MarshalAs(UnmanagedType.ByValArray,...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images