Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
KeyedCollectionExtensions.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System.Collections.Generic;
4 using System.Collections.ObjectModel;
5 
6 namespace SiliconStudio.Core.VisualStudio
7 {
8  public static class KeyedCollectionExtensions
9  {
10  /// <summary>
11  /// Adds the specified enumeration of values to this collection.
12  /// </summary>
13  /// <typeparam name="TKey">The type of the key.</typeparam>
14  /// <typeparam name="TValue">The type of the value.</typeparam>
15  /// <param name="collection">The collection to add the value to.</param>
16  /// <param name="items">The items to add to the collection.</param>
17  public static void AddRange<TKey, TValue>(this KeyedCollection<TKey, TValue> collection, IEnumerable<TValue> items)
18  {
19  if (items != null)
20  {
21  foreach (var item in items)
22  {
23  collection.Add(item);
24  }
25  }
26  }
27  }
28 }