private int Compare(Object x, Object y){
if (x == null || x is Missing)
if (y == null || y is Missing)
return 0;
else
return 1;
else if (y == null || y is Missing)
return -1;
if (this.compareFn != null){
double result = Convert.ToNumber(this.compareFn.Call(new Object[]{x, y}, null));
if (result != result)
throw new JScriptException(JSError.NumberExpected);
return (int)Runtime.DoubleToInt64(result);
}else
return String.CompareOrdinal(Convert.ToString(x), Convert.ToString(y));
}