动态创建泛型接口的的实例


Type tp = typeof(List<>).MakeGenericType(p.DataModel.GetType());

object tob= System.Activator.CreateInstance(tp);
object[] arg=new object[1];
arg[0] = p.DataModel;
tob.GetType().GetMethod("Add").Invoke(tob, arg);
typeof(SiteResume).GetField(p.TargetList).SetValue(sr, tob);

核心部分 哈哈

posted @ 2012-09-12 14:48  ppshinebl  阅读(319)  评论(0编辑  收藏  举报