BitConverter: ToDecimal |
Converts an array of bytes do a Variant Decimal value.
Public Function ToDecimal( ByRef Value ( ) As Byte, ByVal StartIndex As Long ) As Variant
The Decimal type is created from 16 bytes with the same layout as used in .NET. The layout is different than that of Visual Basic.
The differing layouts is shown in the following table.
Framework | Layout |
---|---|
Visual Basic |
bytes 0-1: Variant type information (Decimal has value 14) bytes 2: precision bytes 3: sign (&H80 is negative) bytes 4-7: the 32 highest bits in the 96bit value bytes 8-11: the 32 lowest bits in the 96bit value bytes 12-15: the 32 middle bits in the 96bit value |
.NET |
bytes 0-3: the 32 lowest bits in the 96bit value bytes 4-7: the 32 middle bits in the 96bit value bytes 8-11: the 32 highest bits in the 96bit value bytes 12-13: unused (zero) bytes 14: precision bytes 15: sign (&H80 is negative) |
Exception | Condition |
---|---|
ArgumentException | StartIndex is greater than or equal to the length of Value minus 15, and is less than or equal to the length of Value minus 1. |
ArgumentNullException | Value is uninitialized. |
ArgumentOutOfRangeException | StartIndex is less than zero or greater than the length of Value minus 1. -or- The precision is greater than 28. |