AddRange extension enhancement (#771)

This commit is contained in:
Weihan Li
2022-02-01 04:08:19 +08:00
committed by GitHub
parent 3278e8b418
commit 6bed103992

View File

@@ -4,14 +4,14 @@ namespace k8s.Util.Common
{ {
public static void AddRange<T>(this HashSet<T> hashSet, ICollection<T> items) public static void AddRange<T>(this HashSet<T> hashSet, ICollection<T> items)
{ {
if (items == null) if (items == null || hashSet == null)
{ {
return; return;
} }
foreach (var item in items) foreach (var item in items)
{ {
hashSet?.Add(item); hashSet.Add(item);
} }
} }