Esempio n. 1
0
        private static int ComparisionByName(PostOffice first, PostOffice second)
        {
            int cName = string.Compare(first.Name, second.Name, StringComparison.CurrentCultureIgnoreCase);

            if (cName != 0)
            {
                return(cName);
            }

            int cCode = string.Compare(first.Code, second.Code, StringComparison.CurrentCultureIgnoreCase);

            if (cCode != 0)
            {
                return(cCode);
            }

            if (first.IsCentral && !second.IsCentral)
            {
                return(-1);
            }
            else if (!first.IsCentral && second.IsCentral)
            {
                return(1);
            }

            return(0);
        }
Esempio n. 2
0
 /// <summary>
 /// Returns a value indicating whether this instance is equal to the other.
 /// </summary>
 /// <param name="obj">A object to compare to this instance.</param>
 public override bool Equals(object obj)
 {
     if (obj is PostOffice)
     {
         PostOffice other = (PostOffice)obj;
         return((string.Compare(this.Code, other.Code, StringComparison.Ordinal) == 0) && (string.Compare(this.Name, other.Name, StringComparison.Ordinal) == 0));
     }
     return(false);
 }