![](/img/trans.png)
[英]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.