Exemplo n.º 1
0
        /// <summary>
        /// Compares this object to another for sorting purposes
        /// </summary>
        /// <param name="obj">Other object</param>
        /// <returns>Sort value</returns>
        /// <remarks>See <see cref="SortLong"/> for configuration of this value</remarks>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException();
            }
            if (obj.GetType() != typeof(ShortName))
            {
                throw new ArgumentException("Expecting argument of type ShortName");
            }
            var o = (ShortName)obj;

            return(SortLong ? Long.CompareTo(o.Long) : Short.CompareTo(o.Short));
        }
Exemplo n.º 2
0
 public override int CompareTo(Keyword other)
 {
     if (Name != other.Name)
     {
         return(Name.CompareTo(other.Name));
     }
     if (other is Range)
     {
         Range o = (Range)other;
         if (Short != o.Short)
         {
             return(Short.CompareTo(o.Short));
         }
         return(Long.CompareTo(o.Long));
     }
     return(1);
 }