Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [<StructuralEquality;StructuralComparison>]
- type SomeType = {
- Value : int
- }
- let someTypeAsIEquatable = { Value = 3 } :> System.IEquatable<SomeType>
- someTypeAsIEquatable.Equals({Value = 3}) |> ignore // calls Equals(SomeType) directly
- { Value = 3 }.Equals({Value = 4})
- public struct Vector2f : IEquatable<Vector2f>
- [<Struct;CustomEquality;NoComparison>]
- type MyVal =
- val X : int
- new(x) = { X = x }
- override this.Equals(yobj) =
- match yobj with
- | :? MyVal as y -> y.X = this.X
- | _ -> false
- interface System.IEquatable<MyVal> with
- member this.Equals(other) =
- other.X = this.X
- [<Struct>]
- type MyVal =
- val X : int
- new(x) = { X = x }
- for i in 0 .. 1000000 do
- (MyVal(i) = MyVal(i + 1)) |> ignore;;
- Réel : 00:00:00.008, Processeur : 00:00:00.015, GC gén0: 4, gén1: 1, gén2: 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement