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...
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...