You cannot recast the value type at declaration of the dictionary:
ICollection<keyvaluepair><string,>>> Test = new Dictionary<string,>>();
Test.Add(new KeyValuePair<string,>>("a",new List<demoproperty>()));
</demoproperty></keyvaluepair>
If you could then you would not be able to add any
ICollection
, only
List<demoproperty>
which is not what your declaration states
You can instantiate an
ICollection<x>
as a
Dictionary<x>
because Dictionary<tkey,tvalue>; inherits ICollection<tkey,tvalue> but if you change the generic types then they won't match.