Example #1
0
 private void Invariant()
 {
     Contract.Invariant(_lowerBoundary != null);
     Contract.Invariant(_lowerBoundary.Length >= 4);
     Contract.Invariant(_upperBoundary != null);
     Contract.Invariant(_upperBoundary.Length >= 4);
     Contract.Invariant(_lowerBoundary.Length == _upperBoundary.Length);
     Contract.Invariant(LowerBoundary != null);
     Contract.Invariant(UpperBoundary != null);
     Contract.Invariant(LowerBoundary.GetLength() == UpperBoundary.GetLength());
     Contract.Invariant(LowerBoundary.AddressFamily == UpperBoundary.AddressFamily);
 }
Example #2
0
        public override string ToString()
        {
            string upperBoundaryStr = UpperBoundary.ToString().Replace('.', '_');
            string lowerBoundaryStr = LowerBoundary.ToString().Replace('.', '_');

            if (UpperBoundary == double.MaxValue)
            {
                upperBoundaryStr = "andUp";
            }

            return("bin_" + lowerBoundaryStr + "_" + upperBoundaryStr);
        }
 public static string Serialize <T, TComparer>(LowerBoundary <T, TComparer> boundary, string format, IFormatProvider formatProvider) where TComparer : struct, IBoundaryValueComparer <T> =>
 !boundary.IsValid ? InvalidBoundary :
 (boundary.IsClosed ? Symbols.GetSymbol(TokenType.StartClosed) : Symbols.GetSymbol(TokenType.StartOpen)) +
 Serialize <T, TComparer>(boundary.Value, format, formatProvider);