Closed as not planned
Description
Please add interface with in
/ out
keyword without TryGetValue
and attach it to Dictionary so that we could make use for variant of it for other usage
Suppose we have
/// suppose C# has
public interface IVariantDictionary<in TKey,out TValue> { /* all common dictionary function possible to variant */ }
public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary
, IReadOnlyDictionary<TKey, TValue>
, IVariantDictionary<TKey,TValue>
, ISerializable, IDeserializationCallback where TKey : notnull
{
/* current implementation*/
}
/// we can then
class Animal {}
class Dog : Animal {}
var dogs = new Dictionary<string,Dog>();
IVariantDictionary<string,Animal> animals = dogs;
Console.WriteLine("I have animal : " + animals.Count);