C# EntityCollection 和 List 互转
private EntityCollection<T> ToEntityCollection<T>(this List<T> list) where T : class { EntityCollection<T> entityCollection = new EntityCollection<T>(); list.ForEach(entityCollection.Add); return entityCollection; } private List<T> ToList<T>(this EntityCollection<T> entityCollection) where T : class { List<T> list = new List<T>(); foreach (T model in entityCollection) { list.Add(model); } return list; }