For a trivial struct like
[<Struct>]
type MyId =
val id: uint
new(v: uint) = { id = v }
is it recommended to implmement IComparable even if the default behavior is suitable?
For a trivial struct like
[<Struct>]
type MyId =
val id: uint
new(v: uint) = { id = v }
is it recommended to implmement IComparable even if the default behavior is suitable?
This is an opinion question, but my answer is no. Here's what the F# compiler generates for your struct (decompiled back to C#):
This looks reasonably efficient to me, although it could be simplified.
Link to full output.