Byte type in C#

  • Thread starter Thread starter Tabigon
  • Start date Start date
T

Tabigon

Guest
Hi! I'm interested why byte type is a bit different from other integer types. For example we have int that is integer value with sign and there is uint that is integer value without sign. The same for short/ushort and long/ulong. So why do we have byte that is unsigned type and sbyte that is signed byte?

And one more question on the example of byte. If it's unsigned byte we have 8 bit to save our data. But if it's signed byte then we have 1 first bit for sign and 7 bit for storing information, right? So why we can put -128 to sbyte? If we have just 7 bit to write data so the maximum value will be 1111111 = 127 (just as maximum positive sbyte value). I would be very grateful if you clarify these things for me. Or just give me direction to explore that by myself.

Thanks in advance. Have a nice day!

Continue reading...
 

Similar threads

Back
Top