Adf.Business.ValueObject.Postcode.CompareTo C# (CSharp) Method

CompareTo() public method

Compares an Postcode to the supplied object.
public CompareTo ( object obj ) : int
obj object The object to compare to.
return int
        public int CompareTo(object obj)
        {
            Postcode other;
            try
            {
                other = (Postcode) obj;
            }
            catch (InvalidCastException)
            {
                throw new ArgumentException("obj is not a Postcode");
            }

            if (this < other)
            {
                return -1;
            }
            if (this > other)
            {
                return 1;
            }
            return 0;
        }