Apollo 13 - Tao Liu's blog
Failure is not an option.
Wednesday, August 31, 2011
Create generic type using F#
you can use typeof operator to get a concrete type, just like C#'s typeof operator. But when thing comes to the generic type, it becomes different.
in C#, you can do: typeof(List<>), but in F#, if you do typeof
> you will get List
type. The solution is simple: you have to use typedefof
>,this will give a generic type definition and you can use GenerateGenericType to create the concrete type. In summary:
: for get concrete type
: get the generic type definition.
Post a Comment
Post Comments (Atom)