From 4f28dd0f26066539a966201ce5bf10a1110d68a4 Mon Sep 17 00:00:00 2001 From: Loretta Date: Fri, 11 Apr 2025 13:37:29 +0200 Subject: [PATCH] Implement UpdateCollection to CollectionExtensions; --- AyCode.Core/Extensions/CollectionExtensions.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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");