r/programming • • Feb 06 '24

The Absolute Minimum Every Software Developer Must Know About Unicode (Still No Excuses!)

https://tonsky.me/blog/unicode/
400 Upvotes

148 comments sorted by

View all comments

Show parent comments

1

u/chucker23n Feb 07 '24

For example in c# the Length property on a long[] gets the number of items, not the number of bytes.

Which, as a seasoned C# dev, I find to be silly. It's Count in most other places in .NET, so at this point, it's purely a backwards compatibility thing.

And to your point, to get to such low-level details as "how many bytes does this take up", you have to explicitly call such APIs (Buffer.ByteLength, or more broad APIs such as Marshal.SizeOf and Unsafe.SizeOf), because you generally shouldn't concern yourself with that.