private bool ComparePiece(PieceBase source, PieceBase target) { var areBothNull = source == null && target == null; var areBothEqual = source?.Equals(target) ?? false; return(!areBothNull && !areBothEqual); }