F# comparison vs C# IComparable

后端 未结 2 1289
遇见更好的自我
遇见更好的自我 2021-01-12 14:35

My problem, in a nutshell, is this:

What can I do about storing a tuple (or any type with a constraint of \'comparison\') in a C# container that requires an ICom

2条回答
  •  一整个雨季
    2021-01-12 14:56

    Definitely some weirdness going on. FWIW, it works if you construct a System.Tuple<_, _> explicitly, so that might be a workaround:

    let x (y : IComparable) = y
    let t = (2, 3)
    
    x (Tuple<_,_> t)
    

提交回复
热议问题