Skip to content

Instantly share code, notes, and snippets.

@hodzanassredin
Created June 23, 2015 18:09
Show Gist options
  • Save hodzanassredin/a5e3d623e3110b91ced8 to your computer and use it in GitHub Desktop.
Save hodzanassredin/a5e3d623e3110b91ced8 to your computer and use it in GitHub Desktop.
// C#
// public class Test {
// public FSharpSet<int> SetNull { get; set; }
// }
let s : Set<int> = (new Test()).SetNull
//or let s : Set<int> = Unchecked.defaultof<Set<int>>
//The type 'Set<int>' does not have 'null' as a proper value
//if s <> null then s |> Set.isEmpty |> ignore
//nre
s |> Set.isEmpty |> ignore
//correct
if Unchecked.defaultof<Set<int>> <> s then s |> Set.isEmpty |> ignore
if obj.ReferenceEquals (s, null) |> not then s |> Set.isEmpty |> ignore
printfn "%A" argv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment