根据泛型的类型,创建泛型类型的集合对象

如集合对象IEnumerable<>

var type= typeof(TreeNode);           

 Activator.CreateInstance(typeof(IEnumerable<>).MakeGenericType(new Type[] { type }), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new object[] { this, type }, null);

原文地址:https://www.cnblogs.com/liuhaili/p/2222560.html