mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-10 08:18:39 +00:00
Split WoofWare.PawPrint.Domain into a new subtree (#41)
This commit is contained in:
37
WoofWare.PawPrint.Domain/ComparableTypeDefinitionHandle.fs
Normal file
37
WoofWare.PawPrint.Domain/ComparableTypeDefinitionHandle.fs
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace WoofWare.PawPrint
|
||||
|
||||
open System
|
||||
open System.Reflection.Metadata
|
||||
|
||||
[<CustomEquality>]
|
||||
[<CustomComparison>]
|
||||
type ComparableTypeDefinitionHandle =
|
||||
private
|
||||
{
|
||||
_Inner : TypeDefinitionHandle
|
||||
}
|
||||
|
||||
override this.Equals (other) =
|
||||
match other with
|
||||
| :? ComparableTypeDefinitionHandle as other -> this._Inner.GetHashCode () = other._Inner.GetHashCode ()
|
||||
| _ -> false
|
||||
|
||||
override this.GetHashCode () : int = this._Inner.GetHashCode ()
|
||||
|
||||
interface IComparable<ComparableTypeDefinitionHandle> with
|
||||
member this.CompareTo (other : ComparableTypeDefinitionHandle) : int =
|
||||
this._Inner.GetHashCode().CompareTo (other._Inner.GetHashCode ())
|
||||
|
||||
interface IComparable with
|
||||
member this.CompareTo (other : obj) : int =
|
||||
match other with
|
||||
| :? ComparableTypeDefinitionHandle as other ->
|
||||
(this :> IComparable<ComparableTypeDefinitionHandle>).CompareTo other
|
||||
| _ -> failwith "invalid comparison"
|
||||
|
||||
static member Make (h : TypeDefinitionHandle) =
|
||||
{
|
||||
_Inner = h
|
||||
}
|
||||
|
||||
member this.Get = this._Inner
|
Reference in New Issue
Block a user