Skip to content

Instantly share code, notes, and snippets.

@jsakamoto
Created August 27, 2012 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsakamoto/3487956 to your computer and use it in GitHub Desktop.
Save jsakamoto/3487956 to your computer and use it in GitHub Desktop.
これはコンパイルが通る(.NETのFileInfoクラスはnullになりうる)
open System.IO
open System.Linq
let dir = new DirectoryInfo("c:\\")
let fileOfFoo = dir.GetFiles().FirstOrDefault(fun f -> f.Name = "foo")
printfn "%s" (if fileOfFoo = null then "null!" else "exists!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment