What problem does IStructuralEquatable and IStructuralComparable solve?

后端 未结 6 2085
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 15:32

I\'ve noticed these two interfaces, and several associated classes, have been added in .NET 4. They seem a bit superfluous to me; I\'ve read several blogs about them, but I

6条回答
  •  春和景丽
    2020-11-27 15:45

    F# started using them since .net 4. ( .net 2 is here)

    These interfaces are crucial to F#

    let list1 = [1;5;9] 
    let list2 = List.append [1;5] [9]
    
    printfn "are they equal? %b" (list1 = list2)
    
    list1.GetType().GetInterfaces().Dump()
    

提交回复
热议问题