hi there,
I am in the middle of refactoring my class to be a generic class. I am having problems with converting the CompareTo part of the code.
Fact: T has a Int32 property called MyIndex
Here is the Half converted code. CompareTo is giving me grief :)
<snip>
List<T> myList = new List<T>();
myList.Sort(delegate(T a, T b)
{
return a.MyIndex.CompareTo(b.MyIn
dex);
});
</snip>
return a.MyIndex.CompareTo(b.MyIn
dex); // <--- Help with this part of the conversion pls.
I have tried something like but doesn't work.
return a.GetType().GetProperty("M
yIndex").C
ompareTo(b
.GetType()
.GetProper
ty("MyInde
x"));
thanks
Start Free Trial