I have a class which overwrites the Compare method of IComarer class. Can you please explain me the code portion "return v1v2.CompareTo(v2v1)* -1;"? What * is representing here?Why we are subtracting the value by 1?
public class ValueComparator : System.Collections.IComparer
{
public int Compare(Object lhs, object rhs)
{
string v1 = lhs.ToString();
string v2 = rhs.ToString();
string v1v2 = v1 + v2;
string v2v1 = v2 + v1;
return v1v2.CompareTo(v2v1)* -1;
}
}