Unclear on the sizeof for decimal types. Does the size in bytes vary by precision as in sql server? Is the precision variable for the c# type ‘decimal’?
I don’t want to turn on unsafe code to just call sizeof on a decimal type. How would you approach this?
As others have said,
decimalis always 16 bytes (128 bits). The precision ofdecimalis always 28/29 digits. It’s a floating point type, unlike SQL’sDECIMALtype. See my article on it for more details.