Last active
December 20, 2015 04:19
-
-
Save wattsm/6069886 to your computer and use it in GitHub Desktop.
Creating generic types in F#.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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