阅读背景:

如何使我的通用比较器(IComparer)处理空值?

来源:互联网 

I'm trying to write a generic object comparer for sorting, but I have noticed it does not handle the instance where one of the values it's comparing is null. When an object is null, I want it to treat it the same as the empty string. I've tried setting the null values to String.Empty but then I get an error of "Object must be of type String" when calling CompareTo() on it.I'm trying to write a generic object comparer f




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: