/// <summary> /// 泛型LIst<T>转泛型list<V> /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="V"></typeparam> /// <param name="inList"></param> /// <returns></returns> public static List<T> ListToList<T, V>( List<V> inList) where T : class where V : class { if (inList.Count > 0) { var resultList = new List<T>(inList.Count); inList.ForEach((inmodel) => { T result = Activator.CreateInstance<T>(); var propList = typeof (T).GetProperties().ToList(); foreach (var p in propList) { var properties = typeof (V).GetProperties().ToList(); properties.ForEach(pv => { if (p.Name == pv.Name) { p.SetValue(result, pv.GetValue(inmodel, null), null); } }); } resultList.Add(result); }); return resultList; } return default (List<T>); }