12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MECF.Framework.Common.Utilities
- {
- public static class DictionaryExpand
- {
- public static void AddRange<T, S>(this Dictionary<T, S> source, Dictionary<T, S> collection)
- {
- if (collection == null)
- {
- throw new ArgumentNullException("Collection is null");
- }
- foreach (var item in collection)
- {
- if (!source.ContainsKey(item.Key))
- {
- source.Add(item.Key, item.Value);
- }
- else
- {
- // handle duplicate key issue here
- }
- }
- }
- }
- }
|