Sorting an array of Doubles with NaN in it

后端 未结 5 1978
深忆病人
深忆病人 2021-01-11 10:26

This is more of a \'Can you explain this\' type of question than it is anything else.

I came across a problem at work where we were using NaN values in a table, but

5条回答
  •  余生分开走
    2021-01-11 10:50

    Actually, the strange sorting behavior is the result of a bug in .NET 3.5. The bug was addressed with .NET 4.0.

    The only way to resolve it is to use your own custom comparer, or upgrade to .NET 4.0. See Why does .NET 4.0 sort this array differently than .NET 3.5?

提交回复
热议问题