June 2003
Intermediate to advanced
800 pages
34h 20m
English
You need to convert a string into a series of bytes, possibly before writing it to a stream or applying encryption.
Call the GetBytes method on one of the encoding objects from the System.Text namespace.
There is more than one way to represent a string in binary form, depending on the encoding you use. The most common encodings include:
ASCII. Encodes each character in a string using 7 bits. ASCII encoded data can’t contain extended Unicode characters. When using ASCII encoding in .NET, the bits will be padded and the resulting byte array will have one byte for each character.
Full Unicode (or UTF-16). Represents each character in a string using 16 bits. The resulting byte array will have ...
Read now
Unlock full access