I have two self-made objects. PersonalizedCard and BaseCard. I want to compare these two for equality.
The PersonalizedCard inherits BaseCard class.
BaseCard has Color and Number.
PersonalizedCard has Color, Number and Name
(Both of them have at least 20 different variables in them, which I left out for clarity)
I tried casting them both back and forth to check for equality, but haven't found a proper solution yet.
var oldCard = UserCards.Cast<IUserCardObject>().FirstOrDefault((card) => card.PersonalCardObject == CurrentCard);
Here CurrentCard is a BaseCard and I'm comparing it to card.PersonalCardObject which inherits the BaseCard class.
I want to compare BaseCard and PersonalizedCard on Color and Number. If they're both a BaseCard, this should be possible I feel.
How do I do this?