Hello Rahul,
Statement1 :
you are using a directcast inside CompareTo function. its throws invalid cast exception
when argument is not a type of somevaluetype. i think you have to use following.
public int32 CompareTo(object other)
{
temp = other as somevaluetype;
if(temp != null)
return (m_x - temp.m_x);
return -1;
}
Statement2 :
IComparable.CompareTo method don't have any access modifiers. so its consider as private method.
you can't call it from out side. due to that following function throws an compile time error.
n = v.CompareTo(o);
I have tested and implemented this code in C#.
Think this help.