C# EntityCollection 和 List 互转

mac2024-07-06  50

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; }

 

最新回复(0)