Exemple #1
0
        public bool Equals(WordFrequency obj)
        {
            if (obj == null)
            {
                return(false);
            }

            return(_word == obj.Word && _frequency == obj.Frequency);
        }
Exemple #2
0
        public int CompareTo(WordFrequency obj)
        {
            if (Equals(obj))
            {
                return(0);
            }

            int byFrequencyCompare = _frequency.CompareTo(obj.Frequency) * -1;

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

            return(_word.ToLowerInvariant().CompareTo(obj.Word.ToLowerInvariant()));
        }