CompareTo() public method

Compare this symbol to another object.
public CompareTo ( object obj ) : int
obj object The object to compare to.
return int
Beispiel #1
0
        /// <summary>
        /// Compare this to another object.
        /// </summary>
        /// <param name="obj">The object to compare to.</param>
        /// <returns>neg,zero,pos for &lt; = &gt;</returns>
        public int CompareTo(object obj)
        {
            Keyword k = obj as Keyword;

            if (ReferenceEquals(k, null))
            {
                throw new ArgumentException("Cannot compare to null or non-Keyword", "obj");
            }

            return(_sym.CompareTo(k._sym));
        }
Beispiel #2
0
 /// <summary>
 /// Compare this to another object.
 /// </summary>
 /// <param name="obj">The object to compare to.</param>
 /// <returns>neg,zero,pos for &lt; = &gt;</returns>
 public int CompareTo(object obj)
 {
     return(obj is Keyword k
         ? _sym.CompareTo(k._sym)
         : throw new ArgumentException("Cannot compare to null or non-Keyword", nameof(obj)));
 }
Beispiel #3
0
 /// <summary>
 /// Compare this to another object.
 /// </summary>
 /// <param name="obj">The object to compare to.</param>
 /// <returns>neg,zero,pos for &lt; = &gt;</returns>
 public int CompareTo(object obj)
 {
     return(_sym.CompareTo(((Keyword)obj)._sym));
 }