Exemplo n.º 1
0
        public override int CompareTo(NewsItem other)
        {
            int compare = base.CompareTo(other);

            if (compare != 0 && other.GetType() != this.GetType())
            {
                return(compare);
            }

            ForexNewsItem otherItem = (ForexNewsItem)other;

            compare = _impact.CompareTo(otherItem._impact);
            if (compare != 0)
            {
                return(compare);
            }

            compare = _currency.CompareTo(otherItem._currency);
            if (compare != 0)
            {
                return(compare);
            }

            compare = GeneralHelper.CompareNullable(_timeSpan.Value, otherItem._timeSpan.Value);
            return(compare);
        }
Exemplo n.º 2
0
        public override int CompareTo(NewsItem other)
        {
            RssNewsItem otherItem = (RssNewsItem)other;

            if (string.IsNullOrEmpty(Guid) == false)
            {// Just compare the Guids, if they are present, since otherwise some
                // sources republish items and this causes multiplication.
                return(_guid.CompareTo(otherItem._guid));
            }

            int compare = base.CompareTo(other);

            if (compare != 0 || other.GetType() != this.GetType())
            {
                return(compare);
            }

            compare = _author.CompareTo(otherItem.Author);
            if (compare != 0)
            {
                return(compare);
            }

            compare = _comments.CompareTo(otherItem._comments);
            if (compare != 0)
            {
                return(compare);
            }

            compare = GeneralHelper.CompareNullable(_guid, otherItem._guid);
            return(compare);
        }