diff --git a/AyCode.Core/Extensions/CollectionExtensions.cs b/AyCode.Core/Extensions/CollectionExtensions.cs index e17cb65..91c25dc 100644 --- a/AyCode.Core/Extensions/CollectionExtensions.cs +++ b/AyCode.Core/Extensions/CollectionExtensions.cs @@ -6,6 +6,17 @@ namespace AyCode.Core.Extensions { public static class CollectionExtensions { + public static void UpdateCollection(this IList source, IList dataItems, bool isRemove) where TDataItem : IId + { + if (source == null) throw new ArgumentNullException(nameof(source), $"source == null"); + if (dataItems == null) throw new ArgumentNullException(nameof(dataItems), $"dataItems == null"); + + foreach (var dataItem in dataItems) + { + source.UpdateCollection(dataItem, isRemove); + } + } + public static TrackingState UpdateCollection(this IList source, TDataItem dataItem, bool isRemove) where TDataItem : IId { if (source == null) throw new ArgumentNullException(nameof(source), $"source == null");