Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- public class MPDictionary<TKey, TValue> : Dictionary<TKey, TValue>
- {
- /*
- * Properties
- */
- public new TValue this[TKey key]
- {
- get
- {
- TValue result;
- TryGetValue(key, out result);
- return result;
- }
- set
- {
- base[key] = value;
- }
- }
- /*
- * Methods
- */
- public MPDictionary() : base()
- {
- }
- public MPDictionary(int capacity, System.Collections.Generic.IEqualityComparer<TKey> comparer) : base(capacity, comparer)
- {
- }
- public MPDictionary<TKey, TValue> Clone()
- {
- MPDictionary<TKey, TValue> result = new MPDictionary<TKey, TValue>(this.Count, this.Comparer);
- foreach (KeyValuePair<TKey, TValue> entry in this)
- {
- result.Add(entry.Key, entry.Value);
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement