How to get ‘System.Type’ of the module?
For example module:
module Foo =
let bar = 1
And this does not work:
printfn "%s" typeof<Foo>.Name
Error is:
The type 'Foo' is not defined
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It would certainly be nice to have a
moduleofoperator… Since there’s not one, the easiest way to do what you want is probably to use the Metadata library in the F# PowerPack:Unfortunately, this won’t work with dynamic assemblies (such as those generated via F# Interactive). You can do something similar using vanilla
System.Reflectioncalls, but that’s more dependent on having a good understanding of the compiled form that your module takes.