August 2003
Intermediate to advanced
928 pages
32h 1m
English
BitConverter
This class provides static methods
that can be used to convert portions
of a byte array to simple value types. It also contains the
overloaded GetBytes( ) method, which converts
simple data types to byte arrays. These functions can be useful for
creating custom reader and writer classes. For example, a typical
writer class might take specific data, convert it to a byte array,
then pass the byte array to some type of stream object.
public sealed class BitConverter { // Public Static Fields public static readonly bool IsLittleEndian; // =True // Public Static Methods public static long DoubleToInt64Bits(doublevalue); public static byte[ ] GetBytes(boolvalue); public static byte[ ] GetBytes(charvalue); public static byte[ ] GetBytes(doublevalue); public static byte[ ] GetBytes(shortvalue); public static byte[ ] GetBytes(intvalue); public static byte[ ] GetBytes(longvalue); public static byte[ ] GetBytes(floatvalue); public static byte[ ] GetBytes(ushortvalue); public static byte[ ] GetBytes(uintvalue); public static byte[ ] GetBytes(ulongvalue); public static double Int64BitsToDouble(longvalue); public static bool ToBoolean(byte[ ]value, intstartIndex); public static char ToChar(byte[ ]value, intstartIndex); public static double ToDouble(byte[ ]value, intstartIndex); public static short ToInt16(byte[ ]value, intstartIndex); public static int ToInt32(byte[ ]value, intstartIndex); public static long ToInt64(byte[ ]value, intstartIndex ...