33 lines
896 B
C#
33 lines
896 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace De.Lambertz.Essentials
|
|
{
|
|
public class LamDictionary<K, T> : Dictionary<K, T>
|
|
{
|
|
/// <summary>
|
|
/// Erweitert das normale Dictionary um die Möglichkeit
|
|
/// ein Key-Value Paar hinzuzufügen und den (falls vorhanden)
|
|
/// bereits unter dem Schlüssel eingetragenen Value zurück zu
|
|
/// bekommen.
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
public T AddReturnOld(K key,T value)
|
|
{
|
|
T result = default(T);
|
|
|
|
if (this.ContainsKey(key))
|
|
{
|
|
result = this[key];
|
|
this.Remove(key);
|
|
}
|
|
this.Add(key, value);
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|