[英]How do I select all elements in List<Int32> into another List<Int32> with LINQ?
[英]How do I create a spring .Net standalone object of type Int32 defined in the IOC context file?
有点简单的新手问题...我知道如何创建字符串对象,但是如何创建int对象呢?
这是上下文文件中的xml代码片段:
<object id="myString" type="System.String">
<constructor-arg value="foo" />
</object>
<object id="myInt" type="System.Int32">
<<<**** how do I set this ****>>>>
</object>
尝试这个:
<object id="MyInt" type="System.Int32" factory-method="Copy">
<constructor-arg index="0">
<value>123</value>
</constructor-arg>
</object>
尝试这个:
<object id="MyInt" type="System.Int32" factory-method="Parse">
<constructor-arg index="0">
<value>123</value>
</constructor-arg>
</object>
要创建基本类型System.Int32的对象,必须使用factory-method =“ Parse” 。 属性factory-method =“ Copy”不起作用,因为它在System.Int32类型中不存在,因此您必须使用静态方法来执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.