Retrieve MethodInfo of a F# function
问题 I would like to write a function that takes a function f as an argument and returns the System.Reflection.MethodInfo associated to f. I'm not quite sure if it is feasible or not. 回答1: So, I finally found a solution. Very hacky, but hey! It works! (edit: in Debug mode only). let Foo (f:S -> A[] -> B[] -> C[] -> D[] -> unit) = let ty = f.GetType() let argty = [|typeof<S>; typeof<A[]>; typeof<B[]>; typeof<C[]>;typeof<D[]>|] let mi = ty.GetMethod("Invoke", argty) let il = mi.GetMethodBody()