Last active
July 14, 2022 07:12
-
-
Save ianChen806/2043d780ee1310001d74c5aaaeb8712e to your computer and use it in GitHub Desktop.
create generic type instance
This file contains 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
Type[] type = { typeof(string) }; | |
var genericType = typeof(List<>).MakeGenericType(type); | |
var instance = Activator.CreateInstance(genericType); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment