#Can't figure out how to get the LINQ Max of a list of objects.

1 messages · Page 1 of 1 (latest)

desert river
#

Hello, I'm trying to get the max of a list of these objects:

public class CardStatEntry 
    {
        private int abilityBonus;
        private string abilityName;

        public CardStatEntry() 
        {
            abilityBonus = 0;
            abilityName = "";
        }
        
        public CardStatEntry(int bonusValue, string abilityName) 
        {
            this.abilityBonus = bonusValue;
            this.abilityName = abilityName;
        }

        public int AbilityBonus 
        {
            get { return abilityBonus; }
            set { abilityBonus = value; }
        }
                
        public string AbilityName 
        {
            get { return abilityName; }
            set { abilityName = value; }
        }

        public override string ToString()
        {
            return abilityBonus + " " + abilityName;
        }

    }