Пример #1
0
        //static string ToHex(byte[] bytes)
        //{
        //    var sb = new StringBuilder();
        //    foreach (var b in bytes)
        //    {
        //        sb.Append(b.ToString("x2"));
        //    }
        //    return sb.ToString();
        //}

        public bool GuidInRange(Guid id, double start, double end)
        {
            var mongoId = new BsonBinaryData(id, GuidRepresentation.CSharpLegacy);
            var cmp     = PercentageToMongoId(start).CompareTo(mongoId);

            if (cmp > 0)
            {
                return(false);
            }
            if (!IsMax(end))
            {
                return(mongoId.CompareTo(PercentageToMongoId(end)) <= 0);
            }

            return(true);
        }