Example #1
0
        /// <summary>
        /// Returns a string representation of the value.
        /// </summary>
        /// <returns>A string representation of the value.</returns>
        public override string ToString()
        {
            switch (_d)
            {
            case 9:
            {
                var c = new char[18];
                c[0]  = BsonUtils.ToHexChar((_a >> 28) & 0x0f);
                c[1]  = BsonUtils.ToHexChar((_a >> 24) & 0x0f);
                c[2]  = BsonUtils.ToHexChar((_a >> 20) & 0x0f);
                c[3]  = BsonUtils.ToHexChar((_a >> 16) & 0x0f);
                c[4]  = BsonUtils.ToHexChar((_a >> 12) & 0x0f);
                c[5]  = BsonUtils.ToHexChar((_a >> 8) & 0x0f);
                c[6]  = BsonUtils.ToHexChar((_a >> 4) & 0x0f);
                c[7]  = BsonUtils.ToHexChar(_a & 0x0f);
                c[8]  = BsonUtils.ToHexChar((_b >> 12) & 0x0f);
                c[9]  = BsonUtils.ToHexChar((_b >> 8) & 0x0f);
                c[10] = BsonUtils.ToHexChar((_b >> 4) & 0x0f);
                c[11] = BsonUtils.ToHexChar(_b & 0x0f);
                c[12] = BsonUtils.ToHexChar((_c >> 28) & 0x0f);
                c[13] = BsonUtils.ToHexChar((_c >> 24) & 0x0f);
                c[14] = BsonUtils.ToHexChar((_c >> 12) & 0x0f);
                c[15] = BsonUtils.ToHexChar((_c >> 8) & 0x0f);
                c[16] = BsonUtils.ToHexChar((_c >> 4) & 0x0f);
                c[17] = BsonUtils.ToHexChar(_c & 0x0f);
                return(new string(c));
            }

            case 10:
            {
                var c = new char[20];
                c[0]  = BsonUtils.ToHexChar((_a >> 28) & 0x0f);
                c[1]  = BsonUtils.ToHexChar((_a >> 24) & 0x0f);
                c[2]  = BsonUtils.ToHexChar((_a >> 20) & 0x0f);
                c[3]  = BsonUtils.ToHexChar((_a >> 16) & 0x0f);
                c[4]  = BsonUtils.ToHexChar((_a >> 12) & 0x0f);
                c[5]  = BsonUtils.ToHexChar((_a >> 8) & 0x0f);
                c[6]  = BsonUtils.ToHexChar((_a >> 4) & 0x0f);
                c[7]  = BsonUtils.ToHexChar(_a & 0x0f);
                c[8]  = BsonUtils.ToHexChar((_b >> 20) & 0x0f);
                c[9]  = BsonUtils.ToHexChar((_b >> 16) & 0x0f);
                c[10] = BsonUtils.ToHexChar((_b >> 12) & 0x0f);
                c[11] = BsonUtils.ToHexChar((_b >> 8) & 0x0f);
                c[12] = BsonUtils.ToHexChar((_b >> 4) & 0x0f);
                c[13] = BsonUtils.ToHexChar(_b & 0x0f);
                c[14] = BsonUtils.ToHexChar((_c >> 28) & 0x0f);
                c[15] = BsonUtils.ToHexChar((_c >> 24) & 0x0f);
                c[16] = BsonUtils.ToHexChar((_c >> 12) & 0x0f);
                c[17] = BsonUtils.ToHexChar((_c >> 8) & 0x0f);
                c[18] = BsonUtils.ToHexChar((_c >> 4) & 0x0f);
                c[19] = BsonUtils.ToHexChar(_c & 0x0f);
                return(new string(c));
            }

            case 11:
            {
                var c = new char[22];
                c[0]  = BsonUtils.ToHexChar((_a >> 28) & 0x0f);
                c[1]  = BsonUtils.ToHexChar((_a >> 24) & 0x0f);
                c[2]  = BsonUtils.ToHexChar((_a >> 20) & 0x0f);
                c[3]  = BsonUtils.ToHexChar((_a >> 16) & 0x0f);
                c[4]  = BsonUtils.ToHexChar((_a >> 12) & 0x0f);
                c[5]  = BsonUtils.ToHexChar((_a >> 8) & 0x0f);
                c[6]  = BsonUtils.ToHexChar((_a >> 4) & 0x0f);
                c[7]  = BsonUtils.ToHexChar(_a & 0x0f);
                c[8]  = BsonUtils.ToHexChar((_b >> 28) & 0x0f);
                c[9]  = BsonUtils.ToHexChar((_b >> 24) & 0x0f);
                c[10] = BsonUtils.ToHexChar((_b >> 20) & 0x0f);
                c[11] = BsonUtils.ToHexChar((_b >> 16) & 0x0f);
                c[12] = BsonUtils.ToHexChar((_b >> 12) & 0x0f);
                c[13] = BsonUtils.ToHexChar((_b >> 8) & 0x0f);
                c[14] = BsonUtils.ToHexChar((_b >> 4) & 0x0f);
                c[15] = BsonUtils.ToHexChar(_b & 0x0f);
                c[16] = BsonUtils.ToHexChar((_c >> 28) & 0x0f);
                c[17] = BsonUtils.ToHexChar((_c >> 24) & 0x0f);
                c[18] = BsonUtils.ToHexChar((_c >> 12) & 0x0f);
                c[19] = BsonUtils.ToHexChar((_c >> 8) & 0x0f);
                c[20] = BsonUtils.ToHexChar((_c >> 4) & 0x0f);
                c[21] = BsonUtils.ToHexChar(_c & 0x0f);
                return(new string(c));
            }

            case 12:
            {
                var c = new char[24];
                c[0]  = BsonUtils.ToHexChar((_a >> 28) & 0x0f);
                c[1]  = BsonUtils.ToHexChar((_a >> 24) & 0x0f);
                c[2]  = BsonUtils.ToHexChar((_a >> 20) & 0x0f);
                c[3]  = BsonUtils.ToHexChar((_a >> 16) & 0x0f);
                c[4]  = BsonUtils.ToHexChar((_a >> 12) & 0x0f);
                c[5]  = BsonUtils.ToHexChar((_a >> 8) & 0x0f);
                c[6]  = BsonUtils.ToHexChar((_a >> 4) & 0x0f);
                c[7]  = BsonUtils.ToHexChar(_a & 0x0f);
                c[8]  = BsonUtils.ToHexChar((_b >> 28) & 0x0f);
                c[9]  = BsonUtils.ToHexChar((_b >> 24) & 0x0f);
                c[10] = BsonUtils.ToHexChar((_b >> 20) & 0x0f);
                c[11] = BsonUtils.ToHexChar((_b >> 16) & 0x0f);
                c[12] = BsonUtils.ToHexChar((_b >> 12) & 0x0f);
                c[13] = BsonUtils.ToHexChar((_b >> 8) & 0x0f);
                c[14] = BsonUtils.ToHexChar((_b >> 4) & 0x0f);
                c[15] = BsonUtils.ToHexChar(_b & 0x0f);
                c[16] = BsonUtils.ToHexChar((_c >> 28) & 0x0f);
                c[17] = BsonUtils.ToHexChar((_c >> 24) & 0x0f);
                c[18] = BsonUtils.ToHexChar((_c >> 20) & 0x0f);
                c[19] = BsonUtils.ToHexChar((_c >> 16) & 0x0f);
                c[20] = BsonUtils.ToHexChar((_c >> 12) & 0x0f);
                c[21] = BsonUtils.ToHexChar((_c >> 8) & 0x0f);
                c[22] = BsonUtils.ToHexChar((_c >> 4) & 0x0f);
                c[23] = BsonUtils.ToHexChar(_c & 0x0f);
                return(new string(c));
            }

            default:
                throw new NotSupportedException(_d.ToString());
            }
        }