Comparer.Compare needs one Object that implements IComparable but will throw exception if not the first parameter is?

Refector says that it checks only if a implements IComparable public int Compare(object a, object b) { if (a == b) { return 0; } if (a == null) { return -1; } if (b == null) { return 1; } if (this. M_compareInfo! = null) { string str = a as string; string str2 = be as string; if ((str!

= null) && (str2! = null)) { return this. M_compareInfo.

Compare(str, str2); } } IComparable comparable = a as IComparable; if (comparable == null) { throw new ArgumentException(Environment. GetResourceString("Argument_ImplementIComparable")); } return comparable. CompareTo(b) }.

Refector says that it checks only if a implements IComparable. Public int Compare(object a, object b) { if (a == b) { return 0; } if (a == null) { return -1; } if (b == null) { return 1; } if (this. M_compareInfo!

= null) { string str = a as string; string str2 = be as string; if ((str! = null) && (str2! = null)) { return this.

M_compareInfo. Compare(str, str2); } } IComparable comparable = a as IComparable; if (comparable == null) { throw new ArgumentException(Environment. GetResourceString("Argument_ImplementIComparable")); } return comparable.

CompareTo(b); }.

1 I'm not so sure you can just post decompiled proprietry source here. – Joren Oct 19 '09 at 13:00.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions