Question:
[<CompiledName("Hoge")>]
type Piyo = class end
When you define such a type, running typeof<Piyo>.Name
will return "Hoge"
.
Is there a way to get the string "Piyo"
at runtime?
Purpose
I'm writing a library that maps F # types to Yaml.
I'm trying to include in the exception message if Yaml couldn't be converted to an object, which type it couldn't be converted to.
At that time, I want to display it in a format that can be seen from F #.
For example, List<int>
instead of FSharpList<int>
.
Answer: Answer:
The name in F # is output to the resource FSharpSignatureData. AssemblyName in the assembly. Previously, F # Metadata Reader was provided by F # PowerPack , but it has been removed by the current FSharp Compiler Service.