Skip to content

Instantly share code, notes, and snippets.

@colinbull
Created April 24, 2012 17:12
Show Gist options
  • Save colinbull/2481599 to your computer and use it in GitHub Desktop.
Save colinbull/2481599 to your computer and use it in GitHub Desktop.
Find is a process is .NET
let processes = System.Diagnostics.Process.GetProcesses() |> Array.filter (fun p -> p.ProcessName.StartsWith("Raven")) |> Seq.head
let ofEnumerator (enum : System.Collections.IEnumerable) : seq<'a> =
let en = enum.GetEnumerator()
seq {
while en.MoveNext() do
yield en.Current :?> 'a
}
let isNet =
processes.Modules
|> ofEnumerator
|> Seq.exists (fun (s : System.Diagnostics.ProcessModule) -> s.ModuleName.Contains("mscorlib"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment