Appendix C. Bits, bytes, and data types

Here, I show you basic representations of bytes and briefly characterize how they comprise data types. Additionally, I show a few novel features of C# 7.0, which can be useful for IoT development.

Binary encoding: integral types

A byte can be interpreted as an array of bits—that is, an array of logical values. Formally, each entry of this array encodes the byte value V as the weighted sum:

Image

where bi denotes the bit value (0 or 1), i stands for the bit index, and N is the number of bits. The base (radix) of 2 comes from the fact that a single bit can possess two values. The summation weights increase with ...

Get Programming for the Internet of Things: Using Windows 10 IoT Core and Azure IoT Suite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.