IComparer vs Generic IComparer

  • Thread starter Thread starter Arash_89
  • Start date Start date
A

Arash_89

Guest
Hello,

Which one is better at performance?

Thanks

class SortYearAscending : IComparer
{
public int Compare(object x, object y)
{
Person P1 = (Person)x;
Person P2 = (Person)y;

if (P1.Year > P1.Year)
return 1;
else if (P1.Year < P1.Year)
return -1;
else return 0;
}
}


And


class SortYearAscending : IComparer<Person>
{
public int Compare(Person P1,Person P2)
{
if (P1.Year > P1.Year)
return 1;
else if (P1.Year < P1.Year)
return -1;
else return 0;
}
}

Continue reading...
 

Similar threads

K
Replies
0
Views
706
Krassimir Manev
K
K
Replies
0
Views
313
Krassimir Manev
K
Back
Top