{
public RangeItemHeaderValue (long? from, long? to)
{
+ if (from == null && to == null)
+ throw new ArgumentException ();
+
+ if (from != null && to != null && from > to) {
+ throw new ArgumentOutOfRangeException ("from");
+ }
+
+ if (from < 0)
+ throw new ArgumentOutOfRangeException ("from");
+
+ if (to < 0)
+ throw new ArgumentOutOfRangeException ("to");
+
From = from;
To = to;
}
{
return From.GetHashCode () ^ To.GetHashCode ();
}
+
+ public override string ToString ()
+ {
+ if (From == null)
+ return "-" + To.Value;
+
+ if (To == null)
+ return From.Value + "-";
+
+ return From.Value + "-" + To.Value;
+ }
}
}