Skip to content

Instantly share code, notes, and snippets.

@wattsm
Last active December 20, 2015 04:19
Show Gist options
  • Save wattsm/6069886 to your computer and use it in GitHub Desktop.
Save wattsm/6069886 to your computer and use it in GitHub Desktop.
Creating generic types in F#.
let makeGenericType (baseType : Type) (types : Type list) =
if (not baseType.IsGenericTypeDefinition) then
invalidArg "baseType" "The base type specified was not a generic type definition."
baseType.MakeGenericType (
types
|> List.toArray
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment