ParseHexString() public static method

Parses a hex string into its equivalent byte array.
public static ParseHexString ( string s ) : byte[]
s string The hex string to parse.
return byte[]
 /// <summary>
 /// Initializes a new instance of the ObjectId class.
 /// </summary>
 /// <param name="value">The value.</param>
 public ObjectId(string value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     Unpack(BsonUtils.ParseHexString(value), out _timestamp, out _machine, out _pid, out _increment);
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the ObjectId class.
        /// </summary>
        /// <param name="value">The value.</param>
        public ObjectId(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var bytes = BsonUtils.ParseHexString(value);

            FromByteArray(bytes, 0, out _a, out _b, out _c);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the ObjectId class.
        /// </summary>
        /// <param name="value">The value.</param>
        public ObjectId(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            Span <byte> span = stackalloc byte[BsonUtils.GetHexStringBinaryLength(value)];

            BsonUtils.ParseHexString(value, span);
            FromByteSpan(span, 0, out _a, out _b, out _c);
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the ObjectId class.
 /// </summary>
 /// <param name="value">The value.</param>
 public ObjectId(
     string value
     )
 {
     Unpack(BsonUtils.ParseHexString(value), out timestamp, out machine, out pid, out increment);
 }