Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 在Spring.Net中包含通用列表值的通用字典_C# 4.0_Spring.net - Fatal编程技术网

C# 4.0 在Spring.Net中包含通用列表值的通用字典

C# 4.0 在Spring.Net中包含通用列表值的通用字典,c#-4.0,spring.net,C# 4.0,Spring.net,我有一个包含属性的对象: public Dictionary<string, List<Hotel>> CityHotels { get; set; } 公共字典城市酒店{get;set;} 如何使用Spring.Net配置此属性 我试着这样做: <property name="CityHotels"> <dictionary key-type="string" value-type="System.Collections.Gen

我有一个包含属性的对象:

public Dictionary<string, List<Hotel>> CityHotels { get; set; }
公共字典城市酒店{get;set;}
如何使用Spring.Net配置此属性

我试着这样做:

    <property name="CityHotels">
      <dictionary key-type="string" value-type="System.Collections.Generic.List&lt;MyNameSpace.Hotel, MyAssembly>" >
        <entry key="SYD">
            <list element-type="MyNameSpace.Hotel, MyAssembly">
            </list>
        </entry>
      </dictionary>
    </property>

但没有成功:

创建上下文“spring.root”时出错:无法从字符串值“System.Collections.Generic.List`2”加载类型

我做错了什么


在我尝试使用Spring.Net设置类型属性失败后,出现了这种令人费解的混乱局面,因此如果有办法,这将以更干净的方式解决我的问题。

请参阅有关Spring配置的解决方案:


在字典的值类型中,您不需要添加MyAssembly,而需要添加mscorlib for
System.Collections.Generic.List


我希望这对你有帮助

spring配置的解决方案:


在字典的值类型中,您不需要添加MyAssembly,而需要添加mscorlib for
System.Collections.Generic.List


我希望这对你有帮助

我已经看到了这一点,花了几个小时试图让它适应我的情况。你能说得更具体一点吗?我已经看到了,并且花了几个小时试图让它适应我的情况。你能说得更具体些吗?