Example #1
0
        public MongoId(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var bytes = MongoIdHexer.ParseHexString(value);

            FromByteArray(bytes, 0, out _a, out _b, out _c);
        }
Example #2
0
        public static bool TryParse(string s, out MongoId objectId)
        {
            // don't throw ArgumentNullException if s is null
            if (s != null && s.Length == 24)
            {
                byte[] bytes;
                if (MongoIdHexer.TryParseHexString(s, out bytes))
                {
                    objectId = new MongoId(bytes);
                    return(true);
                }
            }

            objectId = default(MongoId);
            return(false);
        }
Example #3
0
 public override string ToString()
 {
     return(MongoIdHexer.ToHexString(ToByteArray()));
 }