不可以.只能进行自定义比较
[<CustomComparison>]
[<StructuralEquality>]
type Node =
| Data of string
| Nil
with
interface System.IComparable with
member x.CompareTo y = 0
Run Code Online (Sandbox Code Playgroud)
请注意,此代码将产生一个警告,建议您在类型上实现相等性.这通常是一个好主意.如果你经历了实现比较的麻烦,那么直接相等(比较== 0).
| 归档时间: |
|
| 查看次数: |
2215 次 |
| 最近记录: |