Create your general method, and then you can do what you do. You do not have to change the usage pattern, because the compiler will be able to derive common types from input types.
public IDictionary<object, object> Copy(IDictionary<TKey, TValue> source)
{
IDictionary<object,object> targetDictionary = new Dictionary<object,object>();
foreach (KeyValuePair<TKey, TValue> sourcePair in sourceDictionary)
{
targetDictionary.Insert(sourcePair.Key, sourcePair.Value);
}
return targetDictionary;
}
IDictionary<TKey, TValue> IDictionary<object, object>, Dictionary<TKey, TValue>, - , .