添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

string className = "Person";
string namespaceStr = "ConsoleApplication1";
var model = Assembly.GetExecutingAssembly().CreateInstance(string.Join(".", new object[] { namespaceStr, className }));
var modelList = Activator.CreateInstance(typeof(List<>).MakeGenericType(new Type[] { model.GetType() }));
var addMethod = modelList.GetType().GetMethod("Add");
addMethod.Invoke(modelList, new object[] { model });