I have:
var someConcreteInstance = new Dictionary<string, Dictionary<string, bool>>();
and I wish to cast it to an interface version, i.e.:
someInterfaceInstance = (IDictionary<string, IDictionary<string, bool>>)someConcreteInstance;
'someInterfaceInstance' is a public property:
IDictionary<string, IDictionary<string, bool>> someInterfaceInstance { get; set; }
This compiles correctly, but throws a runtime casting error.
Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.Dictionary`2[System.String,System.Boolean]]' to type 'System.Collections.Generic.IDictionary`2[System.String,System.Collections.Generic.IDictionary`2[System.String,System.Boolean]]'.
What am I missing? (Problems with the nested generic type/Property?)